feat(ui): show the account switcher when signed-in sessions exist - #9583
Draft
djgould wants to merge 1 commit into
Draft
feat(ui): show the account switcher when signed-in sessions exist#9583djgould wants to merge 1 commit into
djgould wants to merge 1 commit into
Conversation
On multi-session instances, the sign-in start screen redirects to the existing choose route instead of rendering the identifier form when the client already has signed-in sessions. Flows that route through sign-in (e.g. OAuth authorization) continue with an existing account instead of asking for the email again. Add-account navigations bypass the switcher via __clerk_add_account, which the switcher's own action now sets while preserving redirect_url. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 39e732a The changes in this PR will be included in the next version bump. This PR includes changesets to release 23 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 |
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@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: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On multi-session instances, visiting the sign-in start screen while the client already has signed-in sessions now redirects to the existing account switcher (the
chooseroute) instead of rendering the identifier form.Motivation: flows that route through sign-in — most visibly OAuth authorization (
clerk auth login, MCP clients, any "Sign in with X" against a Clerk instance) — currently force already-signed-in users to retype their email on the identifier form, only to be password-skipped into the session they already had. FAPI redirects those flows to/sign-in?redirect_url=<consent screen>, so the fix lives entirely in<SignIn>: pick your account (or continue as the only one), then land on the consent screen.redirect_urlis already inPRESERVED_QUERYSTRING_PARAMS, so the internal navigation keeps the destination.Behavior:
withRedirectToAfterSignInalready forwards signed-in visitors before the new guard runs).?__clerk_add_accountbypasses the switcher and renders the form. The switcher's own Add account action now sets it (previously it would loop) and also preservesredirect_url, fixing a pre-existing gap where an account added mid-flow lost its destination.Testing:
vitestsuites forSignInStart(new: redirect, bypass, no-session cases),SignInAccountSwitcher(un-skipped the add-account test via awindowNavigatemock), andUserButtonall pass. Manual: dashboard prototype of the same rule is running in clerk/dashboard#10106.Note for reviewers: this changes the default for multi-session apps on upgrade — a signed-in visit to
/sign-inshows the switcher where the form used to be. If we want an escape hatch beyond the query param, a<SignIn>prop is a cheap follow-up.Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
🤖 Generated with Claude Code