-
Notifications
You must be signed in to change notification settings - Fork 371
fix(clerk-js): Guard against navigation during setActive
in SignInFactorOne
#6462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 7151ee2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 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 |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -83,21 +85,27 @@ function SignInFactorOneInternal(): JSX.Element { | |||
const [isPasswordPwned, setIsPasswordPwned] = React.useState(false); | |||
|
|||
React.useEffect(() => { | |||
if (__internal_setActiveInProgress) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the behavior - right during setActive
, this component re-renders with an empty sign-in status:
CleanShot.2025-08-02.at.15.51.36.mp4
setActive
is in-progresssetActive
setActive
setActive
in SignInFactorOne
4b8bfc8
to
fd524f4
Compare
fd524f4
to
7151ee2
Compare
📝 WalkthroughWalkthroughA patch was applied to the Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🧰 Additional context used📓 Path-based instructions (11).changeset/**📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Files:
packages/clerk-js/src/ui/**/*.{ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)
Files:
**/*.{js,jsx,ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Files:
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Files:
packages/**/*.{ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Files:
packages/**/*.{ts,tsx,d.ts}📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Files:
**/*.{ts,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Files:
**/*.{jsx,tsx}📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Files:
**/*.{js,ts,tsx,jsx}📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Files:
**/*.tsx📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)
Files:
**/*⚙️ CodeRabbit Configuration File
Files:
🧬 Code Graph Analysis (1)packages/clerk-js/src/ui/components/SignIn/SignInFactorOne.tsx (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (19)
🔇 Additional comments (5)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/elements
@clerk/clerk-expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/clerk-react
@clerk/react-router
@clerk/remix
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/themes
@clerk/types
@clerk/upgrade
@clerk/vue
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
Description
setActive
causesSignInFactorOne
to re-render while the navigation to the after-sign-in URL. SincesignIn
isnull
(already consumed), it causes the factor to beundefined
, and displays an "Use another method" message for a couple of seconds while attempting to navigate to the rootsign-in
route.This PR introduces the following:
useEffect
to not execute the navigation ifsetActive
is in-progressSignInFactorTwo
currently has)Previously (watch in slow speed):
CleanShot.2025-08-02.at.15.38.37.mp4
Now with fixes:
CleanShot.2025-08-02.at.15.45.43.mp4
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit