fix(clerk-js): prevent infinite spinner on factor-two without active 2fa session#7787
Conversation
…ssion Why: Users navigating directly to /sign-in#/factor-two without an active sign-in requiring 2FA would see an infinite loading spinner because there was no status check to redirect them back to sign-in start. What changed: Added useEffect to SignInFactorTwo that redirects to sign-in start when signIn.status is null, needs_identifier, or needs_first_factor. Matches the existing pattern in SignInFactorOne. Key detail: dependency array only includes __internal_setActiveInProgress (not signIn.status) to avoid triggering redirect during valid sign-in completion when status changes to null.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 58f4a39 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
Comment |
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
6da0762 to
58f4a39
Compare
ad6de28 to
58f4a39
Compare
Summary
Backport of #7774 to
release/core-2.Users navigating directly to
/sign-in#/factor-twowithout an active sign-in requiring 2FA would see an infinite loading spinner. Added auseEffecttoSignInFactorTwothat checks sign-in status on mount and redirects appropriately:afterSignInUrlThis handles Fredrik's case where a hard reload after successful verification in the dashboard would leave users stuck on the factor-two spinner.
Test plan
/sign-in#/factor-twowithout an active 2FA session while signed out - should redirect to sign-in start/sign-in#/factor-twowhile already signed in (multi-session app) - should redirect to afterSignInUrl