-
Notifications
You must be signed in to change notification settings - Fork 419
fix(clerk-js): Remove duplicate prepare first factor calls #6134
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): Remove duplicate prepare first factor calls #6134
Conversation
🦋 Changeset detectedLatest commit: 59828e8 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 ↗︎
|
3e2b253 to
3f91967
Compare
📝 WalkthroughWalkthroughThe changes introduce a memoized Assessment against linked issues
Suggested reviewers
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 (
|
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.
Actionable comments posted: 1
🧹 Nitpick comments (3)
packages/clerk-js/src/ui/components/SignIn/__tests__/SignInFactorOneCodeForm.spec.tsx (3)
12-18: Module mock is never restored – may leak into unrelated test files
vi.mock('../../../hooks', …)is declared at top scope, so the mockeduseFetchpersists for the entire test suite (including other files executed later). Wrap the mock invi.mock+vi.importActualinside thedescribeor add anafterAllthat callsvi.unmockto avoid cross-test pollution.
26-29:optionsparameter typed asany– lose IDE help & safetyGive
renderWithProvidersa proper generic signature instead of falling back toany, e.g.:-const renderWithProviders = (component: React.ReactElement, options?: any) => { +const renderWithProviders = <T extends object = unknown>( + component: React.ReactElement, + options?: T, +) => {Small, but it preserves type checking for future contributors.
100-166: Duplicated test scenario – consider merging to keep suite leanThe assertion “still calls prepare when factor is already prepared but verification not verified” appears in both the Cache Key Generation and shouldAvoidPrepare Logic describe blocks. Combining them in a single place will shorten execution time and avoid maintenance divergence.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/clerk-js/src/ui/components/SignIn/SignInFactorOneCodeForm.tsx(3 hunks)packages/clerk-js/src/ui/components/SignIn/__tests__/SignInFactorOneCodeForm.spec.tsx(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: Analyze (javascript-typescript)
packages/clerk-js/src/ui/components/SignIn/SignInFactorOneCodeForm.tsx
Outdated
Show resolved
Hide resolved
@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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.changeset/real-bees-post.md (1)
5-5: Enhance changeset description with context and references.The summary is clear, but adding the issue ID (USER-2179) and explicitly calling out the removal of duplicate prepare-first-factor calls will improve traceability. For example:
“Remove duplicate prepare-first-factor calls (USER-2179) by stabilizing cache‐key generation in SignInFactorOneCodeForm.tsx—no longer relying on
signIn.id.”
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.changeset/real-bees-post.md(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: Build Packages
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
Description
Fixes: USER-2179
Reworked the cache key creation logic not to rely on sign_in.id, which can change after re-renders
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
Summary by CodeRabbit
Tests
Bug Fixes