fix(react): Fix stale SSR state during cross-tab sign-out#7865
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: a850c4c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughAdds a changeset for a patch bump to 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.changeset/dry-mangos-fail.md (1)
5-5: Consider adding cross-tab scenario context.The description is clear and technically accurate. For enhanced user understanding, you could optionally mention the specific cross-tab scenario (e.g., "when signing out in one browser tab while other tabs remain open").
📝 Optional enhancement for user clarity
-Fix navigation hang on cross-tab sign-out by preventing stale SSR state from being used after sign-out detection. +Fix navigation hang when signing out in one browser tab while other authenticated tabs remain open, by preventing stale SSR state from being used after sign-out detection.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.changeset/dry-mangos-fail.md at line 5, Update the changeset description "Fix navigation hang on cross-tab sign-out by preventing stale SSR state from being used after sign-out detection." to explicitly mention the cross-tab scenario (for example: "when signing out in one browser tab while other tabs remain open") so users immediately understand the context; keep the technical explanation about preventing stale SSR state after sign-out detection (the existing phrase) and append a short example clause referencing the cross-tab sign-out behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.changeset/dry-mangos-fail.md:
- Line 5: Update the changeset description "Fix navigation hang on cross-tab
sign-out by preventing stale SSR state from being used after sign-out
detection." to explicitly mention the cross-tab scenario (for example: "when
signing out in one browser tab while other tabs remain open") so users
immediately understand the context; keep the technical explanation about
preventing stale SSR state after sign-out detection (the existing phrase) and
append a short example clause referencing the cross-tab sign-out behavior.
jacekradko
left a comment
There was a problem hiding this comment.
@bratsos I am wondering if other hooks like useUserBase for example have the same issue of returning stale initialState ?
f861ecc to
d81e40f
Compare
I completely changed the directory, this was indeed not the issue. Please check again! 🙏 |
Ephem
left a comment
There was a problem hiding this comment.
This looks like a pragmatic fix, nice find! 🙏
c683ba9 to
fc44a98
Compare
Description
When a user signs out in one browser tab, other tabs viewing protected pages hang instead of redirecting to the sign-in page. The page remains stuck showing stale authentication data even though the session has been terminated.
Reproduction:
Root Cause
The issue was in
@clerk/nextjsApp Router awaitable navigation:RedirectToSignIncan trigger duplicate router.push calls to the same destination while the first transition is still in flight (commonly observed in dev/StrictMode-like remount/effect replay behavior).isPendingstuck and preventing promise buffer flush.Result: redirect flow appears hung even though auth state is already signed out.
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
Bug Fixes
Tests
Chores