-
Notifications
You must be signed in to change notification settings - Fork 361
fix(clerk-js): Require email or phone when password field is visible #6259
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
base: main
Are you sure you want to change the base?
fix(clerk-js): Require email or phone when password field is visible #6259
Conversation
🦋 Changeset detectedLatest commit: 3855fde 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 ↗︎
|
📝 WalkthroughWalkthroughA patch was applied to the '@clerk/clerk-js' package to address a bug in the sign-up process involving password authentication when used with email or phone number fields. The validation logic for the required status of these fields was updated to more accurately reflect when email or phone inputs should be marked as required or optional, especially in progressive sign-up scenarios. Associated tests were updated and expanded to verify these conditions, including renaming and enhancing existing tests and adding new scenarios to ensure correct behavior when password, email, and phone requirements interact. Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (4)
🧰 Additional context used📓 Path-based instructions (12)`**/*.{js,jsx,ts,tsx}`: All code must pass ESLint checks with the project's conf...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/development.mdc) List of files the instruction was applied to:
`**/{__tests__,**/__tests__}/**/*.{js,jsx,ts,tsx}`: Test files should be co-located with source files or in `__tests__` directories
📄 Source: CodeRabbit Inference Engine (.cursor/rules/development.mdc) List of files the instruction was applied to:
`packages/**/*.{ts,tsx,d.ts}`: Packages should export TypeScript types alongside runtime code
📄 Source: CodeRabbit Inference Engine (.cursor/rules/development.mdc) List of files the instruction was applied to:
`**/*.{ts,tsx}`: Use proper TypeScript error types
📄 Source: CodeRabbit Inference Engine (.cursor/rules/development.mdc) List of files the instruction was applied to:
`**/*.{tsx,jsx}`: Use error boundaries in React components Minimize re-renders in React components
📄 Source: CodeRabbit Inference Engine (.cursor/rules/development.mdc) List of files the instruction was applied to:
`**/*.{test,spec}.{js,ts,tsx}`: Unit tests should use Jest or Vitest as the test runner.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc) List of files the instruction was applied to:
`packages/{clerk-js,elements,themes}/**/*`: Visual regression testing should be performed for UI components.
📄 Source: CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc) List of files the instruction was applied to:
`**/*.{jsx,tsx}`: Always use functional components with hooks instead of class c...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/react.mdc) List of files the instruction was applied to:
`**/*.tsx`: Use proper type definitions for props and state Leverage TypeScript'...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/react.mdc) List of files the instruction was applied to:
`**/*.{ts,tsx}`: Always define explicit return types for functions, especially p...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/typescript.mdc) List of files the instruction was applied to:
`**/__tests__/**/*.{ts,tsx}`: Use Vitest for type-safe testing in TypeScript Cre...
📄 Source: CodeRabbit Inference Engine (.cursor/rules/typescript.mdc) List of files the instruction was applied to:
`packages/**/*.ts`: TypeScript is required for all packages
📄 Source: CodeRabbit Inference Engine (.cursor/rules/development.mdc) List of files the instruction was applied to:
🧠 Learnings (5)📓 Common learnings
.changeset/fair-olives-wish.md (6)
packages/clerk-js/src/ui/components/SignUp/__tests__/SignUpStart.spec.tsx (12)
packages/clerk-js/src/ui/components/SignUp/signUpFormHelpers.ts (5)
packages/clerk-js/src/ui/components/SignUp/__tests__/signUpFormHelpers.test.ts (15)
🔇 Additional comments (8)
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 (
|
Description
When password authentication is enabled alongside email/phone identifiers in progressive sign-up, the field requirement logic was not correctly determining which identifier should be marked as optional. This led to incorrect validation behavior where required fields might be incorrectly treated as optional.
Solution
For Email Address Fields:
For Phone Number Fields:
clerk-js-fix-email-required-before.mp4
clerk-js-fix-email-required-after.mp4
Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit
Bug Fixes
Tests