Skip to content

fix(ui): Stop the sign-in start card flashing after a code is accepted - #9331

Draft
dmoerner wants to merge 1 commit into
mainfrom
fix/sign-in-start-card-flash-after-set-active
Draft

fix(ui): Stop the sign-in start card flashing after a code is accepted#9331
dmoerner wants to merge 1 commit into
mainfrom
fix/sign-in-start-card-flash-after-set-active

Conversation

@dmoerner

@dmoerner dmoerner commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

After a verification code was accepted, the sign-in start card could reappear for a moment before the app rendered its signed-in state.

SignInFactorOne has a guard that sends you back to the start of the flow when the sign-in has no status left, written for "user tried a social button, then came back". #6462 gave that guard an early-return while setActive is running, and in doing so made it re-run every time setActive starts or stops rather than only on mount. So it runs once more as setActive finishes -- and at that point a successful sign-in also has no status left, because completing it consumed the sign-in. The guard can't tell the two cases apart, so it sends a user who just signed in back to the start card.

It only showed up sometimes because it needs the card to re-render both during setActive and again after it, racing whatever the app does once the session exists.

The fix records that setActive took over, so a card that has handed off navigation never sends the user back. Behaviour for a genuinely abandoned sign-in is unchanged. SignInFactorTwo has the same guard and the same bug, so it gets the same fix.

This PR was written by Claude based on a reproduction video that I was able to record. Reproduction video, at round 6.85 seconds:

sign-in-bounce.mp4

Description

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

After a verification code was accepted, the sign-in start card could reappear
for a moment before the app rendered its signed-in state.

`SignInFactorOne` has a guard that sends you back to the start of the flow when
the sign-in has no status left, written for "user tried a social button, then
came back". #6462 gave that guard an early-return while `setActive` is running,
and in doing so made it re-run every time `setActive` starts or stops rather
than only on mount. So it runs once more as `setActive` finishes -- and at that
point a successful sign-in also has no status left, because completing it
consumed the sign-in. The guard can't tell the two cases apart, so it sends a
user who just signed in back to the start card.

It only showed up sometimes because it needs the card to re-render both during
`setActive` and again after it, racing whatever the app does once the session
exists.

The fix records that `setActive` took over, so a card that has handed off
navigation never sends the user back. Behaviour for a genuinely abandoned
sign-in is unchanged. `SignInFactorTwo` has the same guard and the same bug,
so it gets the same fix.

This PR was written by Claude based on a reproduction video that I was
able to record.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 715a736

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

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

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview Aug 4, 2026 6:23pm
swingset Ready Ready Preview Aug 4, 2026 6:23pm

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Aug 4, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@9331

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@9331

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@9331

@clerk/expo

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

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@9331

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@9331

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 715a736

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.

1 participant