-
Notifications
You must be signed in to change notification settings - Fork 371
feat(clerk-js,clerk-react,nextjs): Introduce <TaskSelectOrganization />
component
#6376
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: acac882 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 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 ↗︎
|
<TaskSelectOrganization />
component <TaskSelectOrganization />
component
I'll open the PR to generate a snapshot, but it's not ready for review yet. |
9bb3556
to
6254f92
Compare
a476efc
to
f8201ba
Compare
📝 WalkthroughWalkthroughThis change set introduces a new standalone React component Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes 🪧 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 (
|
f8201ba
to
504dc93
Compare
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 (1)
packages/clerk-js/src/ui/types.ts (1)
28-40
: Fix inconsistent formatting in re-exports.The re-export section has inconsistent formatting. Some exports have trailing commas while others don't, and the ordering appears mixed.
Consider standardizing the formatting:
export type { __internal_OAuthConsentProps, __internal_UserVerificationProps, + APIKeysProps, CreateOrganizationProps, GoogleOneTapProps, OrganizationListProps, OrganizationProfileProps, OrganizationSwitcherProps, + PricingTableProps, SignInProps, SignUpProps, + TaskSelectOrganizationProps, UserButtonProps, UserProfileProps, WaitlistProps, };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
packages/clerk-js/src/core/clerk.ts
(2 hunks)packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
(3 hunks)packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
(2 hunks)packages/clerk-js/src/ui/components/SessionTasks/index.tsx
(5 hunks)packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
(4 hunks)packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
(3 hunks)packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
(1 hunks)packages/clerk-js/src/ui/lazyModules/components.ts
(4 hunks)packages/clerk-js/src/ui/types.ts
(4 hunks)packages/types/src/appearance.ts
(2 hunks)packages/types/src/clerk.ts
(2 hunks)
📓 Path-based instructions (11)
packages/types/src/appearance.ts
📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)
Add new element descriptor types in packages/types/src/appearance.ts before using them elsewhere
Files:
packages/types/src/appearance.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}
: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}
: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*
⚙️ CodeRabbit Configuration File
**/*
: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.Whenever reviewing a pull request, if there are any changes that could impact security, always tag
clerk/security
in the PR.Security-impacting changes include, but are not limited to:
- Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
- Any modification to access control, authorization checks, or role-based permissions
- Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
- Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
- Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
- Modifications to security headers, cookie flags, CORS policies, or CSRF protections
- Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
- Changes to rate limiting, abuse prevention, or input validation
If you're unsure whether a change is security-relevant, err on the side of caution and tag
clerk/security
.Any time that you tag
clerk/security
, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
packages/clerk-js/src/ui/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)
packages/clerk-js/src/ui/**/*.{ts,tsx}
: Element descriptors should always be camelCase
Use element descriptors in UI components to enable consistent theming and styling via appearance.elements
Element descriptors should generate unique, stable CSS classes for theming
Element descriptors should handle state classes (e.g., cl-loading, cl-active, cl-error, cl-open) automatically based on component state
Do not render hard-coded values; all user-facing strings must be localized using provided localization methods
Use the useLocalizations hook and localizationKeys utility for all text and error messages
Use the styled system (sx prop, theme tokens, responsive values) for custom component styling
Use useCardState for card-level state, useFormState for form-level state, and useLoadingStatus for loading states
Always use handleError utility for API errors and use translateError for localized error messages
Use useFormControl for form field state, implement proper validation, and handle loading and error states in forms
Use localization keys for all form labels and placeholders
Use element descriptors for consistent styling and follow the theme token system
Use the Card and FormContainer patterns for consistent UI structure
Files:
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*.{jsx,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}
: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}
: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile
,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
**/*.tsx
📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)
**/*.tsx
: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
🧬 Code Graph Analysis (8)
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx (1)
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (1)
useSessionTasksContext
(12-30)
packages/types/src/clerk.ts (1)
packages/types/src/appearance.ts (1)
TaskSelectOrganizationTheme
(959-959)
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx (2)
packages/clerk-js/src/ui/elements/contexts/index.tsx (1)
withCardStateProvider
(72-81)packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (1)
TaskSelectOrganizationContext
(32-32)
packages/clerk-js/src/ui/lazyModules/components.ts (3)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
APIKeys
(206-206)packages/clerk-js/src/core/modules/apiKeys/index.ts (1)
APIKeys
(14-101)packages/react/src/components/uiComponents.tsx (1)
APIKeys
(609-635)
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (1)
packages/clerk-js/src/ui/types.ts (2)
SessionTasksCtx
(136-139)TaskSelectOrganizationCtx
(141-143)
packages/clerk-js/src/core/clerk.ts (2)
packages/types/src/clerk.ts (1)
APIKeysProps
(1768-1791)packages/shared/src/telemetry/events/component-mounted.ts (1)
eventPrebuiltComponentMounted
(51-57)
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (2)
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (2)
TaskSelectOrganizationContext
(32-32)SessionTasksContext
(6-6)packages/types/src/clerk.ts (1)
TaskSelectOrganizationProps
(1956-1963)
packages/clerk-js/src/ui/types.ts (1)
packages/types/src/clerk.ts (2)
APIKeysProps
(1768-1791)TaskSelectOrganizationProps
(1956-1963)
🧰 Additional context used
📓 Path-based instructions (11)
packages/types/src/appearance.ts
📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)
Add new element descriptor types in packages/types/src/appearance.ts before using them elsewhere
Files:
packages/types/src/appearance.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}
: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}
: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*
⚙️ CodeRabbit Configuration File
**/*
: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.Whenever reviewing a pull request, if there are any changes that could impact security, always tag
clerk/security
in the PR.Security-impacting changes include, but are not limited to:
- Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
- Any modification to access control, authorization checks, or role-based permissions
- Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
- Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
- Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
- Modifications to security headers, cookie flags, CORS policies, or CSRF protections
- Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
- Changes to rate limiting, abuse prevention, or input validation
If you're unsure whether a change is security-relevant, err on the side of caution and tag
clerk/security
.Any time that you tag
clerk/security
, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.
Files:
packages/types/src/appearance.ts
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/types/src/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/core/clerk.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
packages/clerk-js/src/ui/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)
packages/clerk-js/src/ui/**/*.{ts,tsx}
: Element descriptors should always be camelCase
Use element descriptors in UI components to enable consistent theming and styling via appearance.elements
Element descriptors should generate unique, stable CSS classes for theming
Element descriptors should handle state classes (e.g., cl-loading, cl-active, cl-error, cl-open) automatically based on component state
Do not render hard-coded values; all user-facing strings must be localized using provided localization methods
Use the useLocalizations hook and localizationKeys utility for all text and error messages
Use the styled system (sx prop, theme tokens, responsive values) for custom component styling
Use useCardState for card-level state, useFormState for form-level state, and useLoadingStatus for loading states
Always use handleError utility for API errors and use translateError for localized error messages
Use useFormControl for form field state, implement proper validation, and handle loading and error states in forms
Use localization keys for all form labels and placeholders
Use element descriptors for consistent styling and follow the theme token system
Use the Card and FormContainer patterns for consistent UI structure
Files:
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/lazyModules/components.ts
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
packages/clerk-js/src/ui/types.ts
**/*.{jsx,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}
: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}
: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile
,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
**/*.tsx
📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)
**/*.tsx
: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx
🧬 Code Graph Analysis (8)
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx (1)
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (1)
useSessionTasksContext
(12-30)
packages/types/src/clerk.ts (1)
packages/types/src/appearance.ts (1)
TaskSelectOrganizationTheme
(959-959)
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx (2)
packages/clerk-js/src/ui/elements/contexts/index.tsx (1)
withCardStateProvider
(72-81)packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (1)
TaskSelectOrganizationContext
(32-32)
packages/clerk-js/src/ui/lazyModules/components.ts (3)
packages/clerk-js/src/ui/components/ApiKeys/ApiKeys.tsx (1)
APIKeys
(206-206)packages/clerk-js/src/core/modules/apiKeys/index.ts (1)
APIKeys
(14-101)packages/react/src/components/uiComponents.tsx (1)
APIKeys
(609-635)
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (1)
packages/clerk-js/src/ui/types.ts (2)
SessionTasksCtx
(136-139)TaskSelectOrganizationCtx
(141-143)
packages/clerk-js/src/core/clerk.ts (2)
packages/types/src/clerk.ts (1)
APIKeysProps
(1768-1791)packages/shared/src/telemetry/events/component-mounted.ts (1)
eventPrebuiltComponentMounted
(51-57)
packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (2)
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (2)
TaskSelectOrganizationContext
(32-32)SessionTasksContext
(6-6)packages/types/src/clerk.ts (1)
TaskSelectOrganizationProps
(1956-1963)
packages/clerk-js/src/ui/types.ts (1)
packages/types/src/clerk.ts (2)
APIKeysProps
(1768-1791)TaskSelectOrganizationProps
(1956-1963)
⏰ 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). (3)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (29)
packages/types/src/appearance.ts (1)
959-959
: LGTM! Appearance support correctly implemented.The new
TaskSelectOrganizationTheme
type alias andtaskSelectOrganization
property in theAppearance
interface follow the established patterns perfectly. The JSDoc documentation is consistent with other component theme overrides, and the implementation correctly enables appearance customization for the new component.Also applies to: 1032-1035
packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx (1)
9-9
: LGTM! Improved session task navigation abstraction.The changes enhance the API by:
- Using a custom
useSessionTasksContext()
hook instead of rawuseContext()
for better abstraction- Replacing
nextTask
with the more descriptivenavigateToTaskIfAvailable()
method name- Maintaining the same conditional logic flow
This aligns well with the broader session task navigation refactor mentioned in the AI summary.
Also applies to: 17-17, 28-29
packages/clerk-js/src/ui/components/SessionTasks/tasks/ForceOrganizationSelection.tsx (3)
3-3
: LGTM! Necessary imports for context consumption.The added
useContext
import andTaskSelectOrganizationContext
import are correctly added to support the new appearance theming functionality.Also applies to: 6-6
15-15
: LGTM! Component rename improves public API.Renaming from
ForceOrganizationSelectionTask
toTaskSelectOrganization
provides a more user-friendly and descriptive name, which aligns well with the PR objective of exposing this as a public component.
46-46
: LGTM! Appearance theming correctly implemented.The context consumption pattern is well-implemented:
useContext(TaskSelectOrganizationContext)
correctly accesses the task contextctx?.appearance
is safely passed to theOrganizationListContext.Provider
- This enables appearance customization to flow through to the organization list components
The implementation follows established patterns and enables the theming functionality defined in the appearance types.
Also applies to: 57-57
packages/types/src/clerk.ts (1)
1956-1963
: LGTM! Well-structured type definition.The
TaskSelectOrganizationProps
type is properly defined with clear JSDoc documentation, appropriate TypeScript conventions, and good integration with the existing appearance theme system.packages/clerk-js/src/ui/lazyModules/components.ts (2)
23-26
: LGTM! Proper lazy loading setup for TaskSelectOrganization.The component is correctly configured with appropriate webpack chunking, proper lazy loading patterns, and integrated into the ClerkComponents export object following established conventions.
Also applies to: 108-110, 160-160
120-120
: Minor formatting change detected.This appears to be an unrelated formatting adjustment to the APIKeys export line.
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx (1)
3-5
: LGTM! Proper refactor to use enhanced session tasks context.The changes correctly migrate from direct context usage to the
useSessionTasksContext
hook, which provides enhanced navigation functionality throughnavigateToTaskIfAvailable()
. This aligns with the broader session tasks refactor and follows React hook best practices.Also applies to: 43-43, 95-95
packages/clerk-js/src/core/clerk.ts (2)
1182-1185
: LGTM!The unmount method follows the standard pattern and implementation looks correct.
1167-1167
: Add missing import for TaskSelectOrganizationPropsThe
TaskSelectOrganizationProps
type is declared inpackages/types/src/clerk.ts
but isn’t imported inpackages/clerk-js/src/core/clerk.ts
. Please add the import at the top of the file:// Other imports + import type { TaskSelectOrganizationProps } from '@clerk/types'; export class Clerk { // ... public mountTaskSelectOrganization = (node: HTMLDivElement, props?: TaskSelectOrganizationProps) => {
This ensures the
TaskSelectOrganizationProps
type is recognized.Likely an incorrect or invalid review comment.
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (4)
1-2
: Good import organization.The new imports for
useClerk
anduseCallback
are properly organized and necessary for the enhanced functionality.
8-10
: Well-designed type extension.The
SessionTasksContextType
properly extends the base context with the new navigation method, maintaining type safety.
22-24
: Excellent use of useCallback for memoization.The
navigateToTaskIfAvailable
callback is properly memoized with the correct dependencies (clerk
andredirectUrlComplete
), which will prevent unnecessary re-renders and maintain performance.
32-32
: Consistent context pattern.The new
TaskSelectOrganizationContext
follows the same pattern as the existingSessionTasksContext
, maintaining consistency in the codebase.packages/clerk-js/src/ui/contexts/ClerkUIComponentsContext.tsx (3)
5-5
: LGTM! Import follows established pattern.The import of
TaskSelectOrganizationProps
is consistent with other component prop imports in this file.
29-29
: LGTM! Context imports are properly structured.The import of both
SessionTasksContext
andTaskSelectOrganizationContext
follows the established import pattern and supports the nested provider structure needed for this component.
113-122
: Nested TaskSelectOrganization and SessionTasks contexts are both requiredBoth providers feed distinct consumers in the TaskSelectOrganization flow:
- TaskSelectOrganizationContext supplies appearance and other TaskSelectOrganizationProps (used in ForceOrganizationSelection and the selection pages).
- SessionTasksContext supplies session‐task values (redirectUrlComplete, currentTaskContainer) used by FlowCard (via useSessionTasksContext) to attach the card container and drive navigation.
Since they serve different concerns and neither provider is unused or redundant, the current nested structure is intentional. No changes needed.
packages/clerk-js/src/ui/types.ts (5)
21-21
: LGTM! Import follows established pattern.The import of
TaskSelectOrganizationProps
is correctly added to the existing import statement from@clerk/types
.
58-58
: LGTM! Union type addition is correct.Adding
TaskSelectOrganizationProps
to theAvailableComponentProps
union maintains type safety and follows the established pattern.
141-143
: LGTM! Context type follows established pattern.The
TaskSelectOrganizationCtx
type correctly extendsTaskSelectOrganizationProps
with the requiredcomponentName
property, following the same pattern used by other component context types.
175-175
: LGTM! Union type completion is correct.Adding
TaskSelectOrganizationCtx
to theAvailableComponentCtx
union ensures type completeness and maintains the relationship between component contexts and their names.
137-139
: SessionTasksCtx refactor is self-contained—no action required.
- The old
nextTask
method has been removed and replaced by the newnavigateToTaskIfAvailable
callback (internally wired toclerk.__internal_navigateToTaskIfAvailable
), and no references tonextTask
remain.- Although
currentTaskContainer
is now marked optional in the type, the provider always supplies auseRef<HTMLDivElement>
instance, so existing consumers won’t encounterundefined
at runtime.packages/clerk-js/src/ui/components/SessionTasks/index.tsx (6)
3-3
: LGTM! React imports updated correctly.The removal of
useCallback
anduseState
from React imports aligns with the refactor that eliminates internal state management from this component.
16-24
: LGTM! Navigation method updated correctly.The change from using
nextTask()
tonavigateToTaskIfAvailable()
from the context aligns with the architectural refactor. The dependency array is correctly updated to reflect the new method.This change moves navigation logic from component state into the context hook, which appears to be a cleaner architectural approach.
40-40
: Component usage updated to match rename.The usage of
<TaskSelectOrganization />
correctly matches the renamed import and maintains consistency with the component rename.
76-76
: LGTM! Effect dependencies simplified correctly.The dependency array simplification removes the internal navigation state dependencies, which aligns with the refactor that moves navigation logic to the context level.
94-99
: Context provider value simplified appropriately.The context provider value has been simplified to only include
redirectUrlComplete
andcurrentTaskContainer
, removing thenextTask
method. This aligns with the type changes and architectural refactor that moves navigation logic to the context hook level.The simplification appears to be part of a deliberate refactor to centralize navigation logic.
13-13
: No residual imports of the old component—rename is localized
I searched for any direct imports ofForceOrganizationSelection
and found none beyond the dynamic chunk path and the updated import in
packages/clerk-js/src/ui/components/SessionTasks/index.tsx
. The file name remainsForceOrganizationSelection.tsx
, but its export has been renamed toTaskSelectOrganization
. No other code is importing the old component name, so no further changes are needed.Likely an incorrect or invalid review comment.
504dc93
to
880d0b2
Compare
27b4253
to
55eb835
Compare
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 (2)
.changeset/bright-cats-lay.md (2)
1-4
: Style: use double quotes in front-matter for consistency.Most existing changesets in the repo quote package names with double quotes. Keeping the style consistent avoids noisy diffs later.
-'@clerk/clerk-js': minor -'@clerk/types': minor +"@clerk/clerk-js": minor +"@clerk/types": minor
8-9
: Wording tweak for clarity.“Eject” can be ambiguous; “extract” or “separate” is clearer to most readers.
-It allows you to eject the organization selection task flow from the default `SignIn` and `SignUp` components and render it on custom URL paths using `taskUrls`. +It allows you to separate the organization-selection task from the default `SignIn` and `SignUp` flows and render it on custom URL paths via `taskUrls`.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.changeset/bright-cats-lay.md
(1 hunks)packages/clerk-js/src/core/clerk.ts
(3 hunks)packages/clerk-js/src/core/warnings.ts
(1 hunks)packages/clerk-js/src/ui/lazyModules/components.ts
(3 hunks)
📓 Path-based instructions (1)
.changeset/**
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Automated releases must use Changesets.
Files:
.changeset/bright-cats-lay.md
✅ Files skipped from review due to trivial changes (1)
- packages/clerk-js/src/core/warnings.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/clerk-js/src/ui/lazyModules/components.ts
- packages/clerk-js/src/core/clerk.ts
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/**
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Automated releases must use Changesets.
Files:
.changeset/bright-cats-lay.md
⏰ 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). (4)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Build Packages
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
@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: |
55eb835
to
8145b48
Compare
8145b48
to
13a3b39
Compare
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
.changeset/bright-cats-lay.md
(1 hunks)packages/clerk-js/src/core/clerk.ts
(3 hunks)packages/clerk-js/src/core/warnings.ts
(1 hunks)packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
(3 hunks)packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
(3 hunks)packages/clerk-js/src/ui/components/SessionTasks/index.tsx
(5 hunks)packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
(4 hunks)packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
(2 hunks)packages/clerk-js/src/ui/lazyModules/components.ts
(3 hunks)packages/react/src/components/index.ts
(1 hunks)packages/react/src/components/uiComponents.tsx
(2 hunks)packages/react/src/isomorphicClerk.ts
(4 hunks)packages/types/src/clerk.ts
(3 hunks)
📓 Path-based instructions (9)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}
: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}
: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
**/*.{jsx,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}
: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}
: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile
,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
packages/react/src/components/uiComponents.tsx
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
**/*.tsx
📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)
**/*.tsx
: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
packages/react/src/components/uiComponents.tsx
**/*
⚙️ CodeRabbit Configuration File
**/*
: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.Whenever reviewing a pull request, if there are any changes that could impact security, always tag
clerk/security
in the PR.Security-impacting changes include, but are not limited to:
- Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
- Any modification to access control, authorization checks, or role-based permissions
- Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
- Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
- Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
- Modifications to security headers, cookie flags, CORS policies, or CSRF protections
- Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
- Changes to rate limiting, abuse prevention, or input validation
If you're unsure whether a change is security-relevant, err on the side of caution and tag
clerk/security
.Any time that you tag
clerk/security
, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
🧬 Code Graph Analysis (1)
packages/react/src/isomorphicClerk.ts (1)
packages/types/src/clerk.ts (2)
TaskSelectOrganizationProps
(1971-1978)APIKeysProps
(1783-1806)
✅ Files skipped from review due to trivial changes (1)
- packages/react/src/components/index.ts
🚧 Files skipped from review as they are similar to previous changes (10)
- packages/clerk-js/src/ui/contexts/components/SessionTasks.ts
- packages/clerk-js/src/ui/lazyModules/components.ts
- .changeset/bright-cats-lay.md
- packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
- packages/clerk-js/src/core/warnings.ts
- packages/clerk-js/src/ui/components/OrganizationList/UserMembershipList.tsx
- packages/clerk-js/src/core/clerk.ts
- packages/clerk-js/src/ui/components/SessionTasks/index.tsx
- packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
- packages/types/src/clerk.ts
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}
: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}
: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
**/*.{jsx,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}
: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}
: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile
,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
packages/react/src/components/uiComponents.tsx
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
**/*.tsx
📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)
**/*.tsx
: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
packages/react/src/components/uiComponents.tsx
**/*
⚙️ CodeRabbit Configuration File
**/*
: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.Whenever reviewing a pull request, if there are any changes that could impact security, always tag
clerk/security
in the PR.Security-impacting changes include, but are not limited to:
- Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
- Any modification to access control, authorization checks, or role-based permissions
- Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
- Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
- Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
- Modifications to security headers, cookie flags, CORS policies, or CSRF protections
- Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
- Changes to rate limiting, abuse prevention, or input validation
If you're unsure whether a change is security-relevant, err on the side of caution and tag
clerk/security
.Any time that you tag
clerk/security
, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.
Files:
packages/react/src/components/uiComponents.tsx
packages/react/src/isomorphicClerk.ts
🧬 Code Graph Analysis (1)
packages/react/src/isomorphicClerk.ts (1)
packages/types/src/clerk.ts (2)
TaskSelectOrganizationProps
(1971-1978)APIKeysProps
(1783-1806)
⏰ 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). (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)
🔇 Additional comments (6)
packages/react/src/isomorphicClerk.ts (4)
47-47
: LGTM: Import statement follows established pattern.The import of
TaskSelectOrganizationProps
is consistent with other component prop types imported in this file.
145-145
: LGTM: Premount nodes map follows established pattern.The
premountTaskSelectOrganizationNodes
field follows the same pattern as other component premount maps in the class, maintaining consistency with the existing architecture.
636-638
: LGTM: Hydration logic matches established pattern.The hydration logic for TaskSelectOrganization follows the exact same pattern as other components, ensuring consistent behavior during ClerkJS initialization.
1145-1151
: LGTM: Unmount method implementation is correct.The
unmountTaskSelectOrganization
method follows the established pattern and correctly manages the premount nodes cleanup.packages/react/src/components/uiComponents.tsx (2)
12-12
: LGTM: Import follows established pattern.The import of
TaskSelectOrganizationProps
is consistent with other component prop types imported in this file.
638-664
: LGTM: Component implementation follows established patterns.The
TaskSelectOrganization
component implementation correctly follows the established pattern used by other components in this file:
- Uses
useWaitForComponentMount
hook for proper loading state management- Implements consistent fallback handling logic
- Uses
ClerkHostRenderer
with appropriate mount/unmount methods- Wrapped with
withClerk
HOC using correct component name andrenderWhileLoading: true
- Follows the same conditional rendering pattern as other components
The implementation is consistent with the existing architecture and will integrate seamlessly with the Clerk ecosystem.
13a3b39
to
de3a2bb
Compare
3ddbfe0
to
96b5167
Compare
!snapshot |
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.
Just tested using a local app with the snapshot and it all worked! 🎉
CleanShot.2025-07-24.at.17.02.34.mp4
Only thing that I noticed is that it is allowing me to access my select-organization
task URL after the session is active.
@iagodahlem Good catch! I'll introduce a component guard for active sessions on |
!snapshot |
b23d894
to
e446bc9
Compare
Hey @LauraBeatris - the snapshot version command generated the following package versions:
Tip: Use the snippet copy button below to quickly install the required packages. npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact
npm i @clerk/[email protected] --save-exact |
e446bc9
to
16ed222
Compare
16ed222
to
4281d4c
Compare
4281d4c
to
acac882
Compare
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 (2)
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx (2)
8-22
: Component implementation is clean but consider adding explicit return type.The internal component properly uses the context hook and renders the OrganizationList with appropriate context values. However, following the TypeScript coding guidelines, explicit return types should be added for better type safety.
-const TaskSelectOrganizationInternal = () => { +const TaskSelectOrganizationInternal = (): JSX.Element => {Also, consider adding JSDoc comments for better documentation:
+/** + * Internal component that renders the organization selection interface. + * Uses the task context to provide appearance configuration to the OrganizationList. + */ const TaskSelectOrganizationInternal = (): JSX.Element => {
16-16
: Optional chaining on context property access is unnecessary.The
useTaskSelectOrganizationContext()
hook already throws an error if the context is null (as shown in the relevant code snippets), so the optional chaining operator?.
onctx?.appearance
is redundant.- appearance: ctx?.appearance, + appearance: ctx.appearance,
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/clerk-js/src/core/warnings.ts
(2 hunks)packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
(1 hunks)packages/clerk-js/src/ui/components/SessionTasks/tasks/withTaskGuard.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/clerk-js/src/ui/components/SessionTasks/tasks/withTaskGuard.ts
- packages/clerk-js/src/core/warnings.ts
🧰 Additional context used
📓 Path-based instructions (10)
packages/clerk-js/src/ui/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/clerk-js-ui.mdc)
packages/clerk-js/src/ui/**/*.{ts,tsx}
: Element descriptors should always be camelCase
Use element descriptors in UI components to enable consistent theming and styling via appearance.elements
Element descriptors should generate unique, stable CSS classes for theming
Element descriptors should handle state classes (e.g., cl-loading, cl-active, cl-error, cl-open) automatically based on component state
Do not render hard-coded values; all user-facing strings must be localized using provided localization methods
Use the useLocalizations hook and localizationKeys utility for all text and error messages
Use the styled system (sx prop, theme tokens, responsive values) for custom component styling
Use useCardState for card-level state, useFormState for form-level state, and useLoadingStatus for loading states
Always use handleError utility for API errors and use translateError for localized error messages
Use useFormControl for form field state, implement proper validation, and handle loading and error states in forms
Use localization keys for all form labels and placeholders
Use element descriptors for consistent styling and follow the theme token system
Use the Card and FormContainer patterns for consistent UI structure
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{js,jsx,ts,tsx}
: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
packages/**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
**/*.{ts,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
**/*.{ts,tsx}
: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoidany
type - preferunknown
when type is uncertain, then narrow with type guards
Useinterface
for object shapes that might be extended
Usetype
for unions, primitives, and computed types
Preferreadonly
properties for immutable data structures
Useprivate
for internal implementation details
Useprotected
for inheritance hierarchies
Usepublic
explicitly for clarity in public APIs
Preferreadonly
for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Useconst assertions
for literal types:as const
Usesatisfies
operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports:import type { ... } from ...
Noany
types without justification
Proper error handling with typed errors
Consistent use ofreadonly
for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
**/*.{jsx,tsx}
📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}
: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}
: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile
,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
**/*.{js,ts,tsx,jsx}
📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)
Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
**/*.tsx
📄 CodeRabbit Inference Engine (.cursor/rules/react.mdc)
**/*.tsx
: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
**/*
⚙️ CodeRabbit Configuration File
**/*
: If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.Whenever reviewing a pull request, if there are any changes that could impact security, always tag
@clerk/security
in the PR.Security-impacting changes include, but are not limited to:
- Changes to authentication logic or mechanisms (e.g. login, session handling, token issuance)
- Any modification to access control, authorization checks, or role-based permissions
- Introduction or modification of hashing algorithms, signature verification, or cryptographic primitives
- Handling of sensitive data (e.g. passwords, tokens, secrets, PII)
- Integration with external identity providers (e.g. SSO, OAuth, OpenID Connect)
- Modifications to security headers, cookie flags, CORS policies, or CSRF protections
- Bypass mechanisms (e.g. feature flags, testing overrides) that could weaken protections
- Changes to rate limiting, abuse prevention, or input validation
If you're unsure whether a change is security-relevant, err on the side of caution and tag
@clerk/security
.Any time that you tag
@clerk/security
, please do so explicitly in a code comment, rather than within a collapsed section in a coderabbit comment, such as the "recent review details" section. If you do use the team name in any thinking or non-direct-code-comment content, it can be referred to as "clerk security team" to avoid accidentally printing the tag which sends a notification to the team.
Files:
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx
🧬 Code Graph Analysis (1)
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx (6)
packages/clerk-js/src/ui/contexts/components/SessionTasks.ts (1)
useTaskSelectOrganizationContext
(19-29)packages/clerk-js/src/ui/contexts/components/OrganizationList.ts (1)
OrganizationListContext
(9-9)packages/clerk-js/src/ui/lazyModules/components.ts (2)
OrganizationList
(79-81)TaskSelectOrganization
(108-110)packages/react/src/components/uiComponents.tsx (2)
OrganizationList
(494-520)TaskSelectOrganization
(638-664)packages/clerk-js/src/ui/components/SessionTasks/tasks/withTaskGuard.ts (1)
withTaskGuard
(8-25)packages/clerk-js/src/ui/elements/contexts/index.tsx (1)
withCardStateProvider
(72-81)
⏰ 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). (5)
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: Build Packages
- GitHub Check: semgrep/ci
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskSelectOrganization.tsx (3)
1-6
: Imports are well-organized and follow proper conventions.The imports are logically grouped and use consistent aliasing patterns. The component follows the established patterns for importing contexts, HOCs, and other UI components.
24-26
: HOC composition follows proper patterns but verify security implications.The component is properly wrapped with the necessary HOCs in the correct order:
withCardStateProvider
- provides card state contextwithTaskGuard
- ensures task exists before renderingwithCoreSessionSwitchGuard
- provides session switch protectionSince this component handles organization selection in authentication flows, which could impact access control and authorization, the security team should review this change.
Please have
@clerk/security
review this change as it introduces a new component that handles organization selection in authentication flows, which could impact access control and authorization mechanisms.
1-27
: Consider adding tests for the new component.This is a new component that plays a critical role in the authentication flow. Following the coding guidelines, tests should be added to cover the component's functionality.
Since this PR introduces a new
TaskSelectOrganization
component without corresponding tests, please consider adding unit tests to cover:
- Component renders correctly with proper context
- HOC composition works as expected
- Error handling when context is missing
- Integration with the OrganizationList component
This would help ensure the component behaves correctly across different scenarios and prevent regressions.
Description
After-auth flows are embedded within
SignIn
andSignUp
by default, however, it's possible to eject out of it by declaringtaskUrls
onClerkProvider
:We're exposing a component that internally renders the proper org AIOs and navigates to a
redirectUrlComplete
when resolving theselect-organization
task.Checklist
pnpm test
runs as expected.pnpm build
runs as expected.Type of change
Summary by CodeRabbit
New Features
<TaskSelectOrganization />
component for independent organization selection outside default sign-in and sign-up flows.taskUrls
prop.Improvements