Skip to content

fix(clerk-js): prevent infinite spinner on factor-two without active 2fa session#7787

Merged
nikosdouvlis merged 2 commits intorelease/core-2from
nikos/fix-factor-two-infinite-spinner-core-2
Feb 6, 2026
Merged

fix(clerk-js): prevent infinite spinner on factor-two without active 2fa session#7787
nikosdouvlis merged 2 commits intorelease/core-2from
nikos/fix-factor-two-infinite-spinner-core-2

Conversation

@nikosdouvlis
Copy link
Member

@nikosdouvlis nikosdouvlis commented Feb 6, 2026

Summary

Backport of #7774 to release/core-2.

Users navigating directly to /sign-in#/factor-two without an active sign-in requiring 2FA would see an infinite loading spinner. Added a useEffect to SignInFactorTwo that checks sign-in status on mount and redirects appropriately:

  • If the user is already signed in (e.g. multi-session app like the dashboard, page reload after successful verification), redirects forward to afterSignInUrl
  • If the user is not signed in and the status is invalid for 2FA, redirects back to sign-in start

This 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

  • Navigate directly to /sign-in#/factor-two without an active 2FA session while signed out - should redirect to sign-in start
  • Navigate directly to /sign-in#/factor-two while already signed in (multi-session app) - should redirect to afterSignInUrl
  • Normal 2FA sign-in flow still works as expected

…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.
@vercel
Copy link

vercel bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Feb 6, 2026 11:10am

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 6, 2026

🦋 Changeset detected

Latest commit: 58f4a39

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 6, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nikos/fix-factor-two-infinite-spinner-core-2

Comment @coderabbitai help to get the list of available commands and usage tips.

@nikosdouvlis nikosdouvlis changed the title fix(ui): prevent infinite spinner on factor-two without active 2FA session (core-2 backport) fix(js): prevent infinite spinner on factor-two without active 2fa session Feb 6, 2026
@nikosdouvlis nikosdouvlis changed the title fix(js): prevent infinite spinner on factor-two without active 2fa session fix(clerk-js): prevent infinite spinner on factor-two without active 2fa session Feb 6, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 6, 2026

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@7787

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@7787

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@7787

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@7787

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@7787

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@7787

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@7787

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@7787

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@7787

@clerk/express

npm i https://pkg.pr.new/@clerk/express@7787

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@7787

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@7787

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@7787

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@7787

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@7787

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@7787

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@7787

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@7787

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@7787

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@7787

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@7787

@clerk/types

npm i https://pkg.pr.new/@clerk/types@7787

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@7787

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@7787

commit: 58f4a39

@nikosdouvlis nikosdouvlis force-pushed the nikos/fix-factor-two-infinite-spinner-core-2 branch from ad6de28 to 58f4a39 Compare February 6, 2026 11:48
@nikosdouvlis nikosdouvlis merged commit 1fe87ac into release/core-2 Feb 6, 2026
79 checks passed
@nikosdouvlis nikosdouvlis deleted the nikos/fix-factor-two-infinite-spinner-core-2 branch February 6, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants