fix(ui): prevent infinite spinner on factor-two without active 2FA session#7774
fix(ui): prevent infinite spinner on factor-two without active 2FA session#7774nikosdouvlis wants to merge 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 6b510af The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 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 |
📝 WalkthroughWalkthroughThis change adds a patch-level fix to the sign-in factor-two route handling. A changelog entry documents the fix for an infinite loading spinner. The SignInFactorTwo component now imports runtime hooks from Clerk and a router utility. A new useEffect hook has been added that redirects users back to the sign-in start path when the component mounts if the sign-in status is null, 'needs\_identifier', or 'needs\_first\_factor', unless an operation is already in progress. The redirect is skipped when sign-in status is 'complete' to allow setActive to handle navigation. The component's rendering logic remains unchanged. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
…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.
5b2e2e4 to
6b510af
Compare
@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/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: |
Summary
Users navigating directly to
/sign-in#/factor-twowithout an active sign-in requiring 2FA would see an infinite loading spinner. This adds a status check to redirect them back to sign-in start, matching the existing pattern inSignInFactorOne.useEffecttoSignInFactorTwothat redirects whensignIn.statusisnull,needs_identifier, orneeds_first_factor__internal_setActiveInProgress(notsignIn.status) to avoid flash during valid sign-in completionWhy not
signIn.status !== 'needs_second_factor'?That condition catches
completestatus, causing a flash to the sign-in page before the final redirect. By explicitly checking for invalid statuses only, we avoid interfering with the normal sign-in completion flow.Test plan
/sign-in#/factor-twowithout active sign-in → redirects to sign-in start🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes