Skip to content

fix(ui): Prevent infinite loading spinner on factor-two without active 2FA#7751

Closed
alexcarpenter wants to merge 2 commits intomainfrom
alexcarpenter/fix-signin-spinner
Closed

fix(ui): Prevent infinite loading spinner on factor-two without active 2FA#7751
alexcarpenter wants to merge 2 commits intomainfrom
alexcarpenter/fix-signin-spinner

Conversation

@alexcarpenter
Copy link
Member

@alexcarpenter alexcarpenter commented Feb 3, 2026

Description

Fixes an issue where users landing on the factor-two sign-in route without an active 2FA session would see an infinite loading spinner. This can occur when navigating directly to the URL with a force redirect parameter. The fix adds a status check to redirect users back to the sign-in start page if the sign-in status is not 'needs_second_factor', matching the existing pattern in SignInFactorOne.

Test Plan

  • ✅ Added test case for navigation when sign-in status is invalid
  • ✅ All 29 existing SignInFactorTwo tests pass
  • ✅ Test fails without the fix (confirms bug), passes with the fix (confirms fix works)

Type of change

  • 🐛 Bug fix

Summary by CodeRabbit

Bug Fixes

  • Fixed an infinite loading spinner that appeared when accessing the two-factor sign-in page without an active 2FA session. Users are now properly redirected to the main sign-in page in this scenario.

…e 2FA session

When users land on the factor-two sign-in route without an active 2FA session (e.g., via a force redirect URL), they would get stuck on an infinite loading spinner. This fix adds a status check to redirect users back to the sign-in start page if the sign-in status is not 'needs_second_factor', matching the pattern already implemented in SignInFactorOne.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 3, 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 3, 2026 9:16pm

Request Review

@changeset-bot
Copy link

changeset-bot bot commented Feb 3, 2026

🦋 Changeset detected

Latest commit: 9942e36

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

This PR includes changesets to release 2 packages
Name Type
@clerk/ui Patch
@clerk/chrome-extension 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 3, 2026

📝 Walkthrough

Walkthrough

This change fixes an infinite loading spinner issue in the SignInFactorTwo component. The fix adds a redirect mechanism that navigates users back to the sign-in start route when they access the factor-two sign-in page without an active second-factor authentication session. A React effect monitors the sign-in status and router to trigger the redirect when the status is not 'needs_second_factor'. A changeset entry documents this patch release, and a new test replaces a placeholder to verify the navigation behavior occurs as expected.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(ui): Prevent infinite loading spinner on factor-two without active 2FA' accurately and specifically summarizes the main bug fix in the changeset.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 3, 2026

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7751

@clerk/upgrade

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

@clerk/vue

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

commit: 9942e36

@alexcarpenter alexcarpenter changed the title fix(ui): prevent infinite loading spinner on factor-two without active 2FA fix(ui): Prevent infinite loading spinner on factor-two without active 2FA Feb 3, 2026
Comment on lines +38 to +40
if (signIn.status !== 'needs_second_factor') {
void router.navigate('../');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we detect if the user is signed in and redirect to any present redirect url in that case? 🤔

@alexcarpenter
Copy link
Member Author

closing in favor of #7774

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants