-
Notifications
You must be signed in to change notification settings - Fork 320
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
fix(clerk-js): Avoid triggering email code verification twice on React strict mode #5095
fix(clerk-js): Avoid triggering email code verification twice on React strict mode #5095
Conversation
🦋 Changeset detectedLatest commit: c35b8ee 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 ↗︎
|
663b1d4
to
7d33778
Compare
7d33778
to
1bad83b
Compare
{ | ||
name: 'prepare', | ||
strategy: props.factor.strategy, | ||
}, |
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.
- Let's use a more specific name for the cache key
- If you go back to start and use a different identifier (email) it would not auto-prepare on render.
{ | |
name: 'prepare', | |
strategy: props.factor.strategy, | |
}, | |
{ | |
name: 'signIn.prepareFirstFactor', | |
factor: props.factor, | |
}, |
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.
Good catch!
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.
I've updated it here: 2c03905
The behavior now is the following: It'll cache for a given identifier, so if you go back to /sign-in
and submit again, it won't send another email cause it's cached - I've added a smaller stale time for that reason, unless you click to "Resend"
When refreshing the page, it'll only fetch once instead of twice (previous bug)
1bad83b
to
732df87
Compare
2c03905
to
4c9858e
Compare
Description
Before
CleanShot.2025-02-06.at.15.28.13.mp4
After
CleanShot.2025-02-06.at.15.29.02.mp4
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change