Skip to content

test(ui): cover setActive guard regressions - #9363

Draft
alexcarpenter wants to merge 3 commits into
mainfrom
carp/pr-9331-regression-tests
Draft

test(ui): cover setActive guard regressions#9363
alexcarpenter wants to merge 3 commits into
mainfrom
carp/pr-9331-regression-tests

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Aug 7, 2026

Copy link
Copy Markdown
Member

Description

Combines the proposed changes from #9331 with regression coverage for factor-one and factor-two navigation after an unrelated setActive lifecycle. This PR targets main so the repository's unit-test workflow runs the reproductions.

In a multi-session/add-account layout, another session or organization switcher can call setActive while the sign-in flow remains mounted. The proposed ref permanently treats that unrelated activation as ownership of sign-in navigation, so a later abandoned or reset sign-in no longer returns to the appropriate earlier route.

This draft is intentionally red against the parent PR. The original three guard tests pass; these two regressions fail until the guard implementation is corrected.

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: regression coverage

dmoerner and others added 2 commits August 4, 2026 14:20
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>
@vercel

vercel Bot commented Aug 7, 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 7, 2026 6:17pm
swingset Ready Ready Preview Aug 7, 2026 6:17pm

Request Review

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7440698

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

@pkg-pr-new

pkg-pr-new Bot commented Aug 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

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

@clerk/electron-passkeys

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

@clerk/eslint-plugin

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

@clerk/expo

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

@clerk/expo-google-signin

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: 7440698

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.

3 participants