Skip to content

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

Merged
merged 8 commits into from
Jul 24, 2025

Conversation

LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Jul 22, 2025

Description

After-auth flows are embedded within SignIn and SignUp by default, however, it's possible to eject out of it by declaring taskUrls on ClerkProvider:

<ClerkProvider taskUrls={{ 'select-organization': '/onboarding' }} /> 

We're exposing a component that internally renders the proper org AIOs and navigates to a redirectUrlComplete when resolving the select-organization task.

function OnboardingPage() { 
return (
  <main> 
    <h1>Welcome to foo, select an organization to start</h1> 
    <TaskSelectOrganization redirectUrlComplete="/onboarding/complete" />
  </main> 
  ) 
}

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • New Features

    • Introduced the new <TaskSelectOrganization /> component for independent organization selection outside default sign-in and sign-up flows.
    • Added methods to mount and unmount the organization selection component programmatically.
    • Enabled customization of the organization selection step via custom routes using the taskUrls prop.
    • Added appearance customization support specifically for the organization selection component.
  • Improvements

    • Enhanced context and theme support for the organization selection flow.
    • Streamlined navigation and session task handling for improved organization selection experience.
    • Simplified session task navigation state and refactored organization selection task with dedicated context provider.
    • Updated component exports and lazy loading to include the new organization selection component.
    • Improved type safety and developer experience with added TypeScript typings for the organization selection component.
    • Added a higher-order component to guard the organization selection task, ensuring correct user session flow.
    • Replaced direct session task navigation calls with internal Clerk navigation methods for consistency.

@LauraBeatris LauraBeatris self-assigned this Jul 22, 2025
Copy link

changeset-bot bot commented Jul 22, 2025

🦋 Changeset detected

Latest commit: acac882

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@clerk/clerk-js Minor
@clerk/types Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/shared Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/themes Patch
@clerk/vue Patch

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

Copy link

vercel bot commented Jul 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 24, 2025 9:52pm

@LauraBeatris LauraBeatris changed the title feat(clerk-js): Export <TaskSelectOrganization /> component feat(clerk-js): Export <TaskSelectOrganization /> component Jul 22, 2025
@LauraBeatris
Copy link
Member Author

I'll open the PR to generate a snapshot, but it's not ready for review yet.

Copy link
Contributor

coderabbitai bot commented Jul 22, 2025

📝 Walkthrough

Walkthrough

This change set introduces a new standalone React component <TaskSelectOrganization /> that enables rendering the organization selection step separately from the default sign-in and sign-up flows. It adds public methods to the Clerk and IsomorphicClerk classes to mount and unmount this component on specified DOM nodes. The component is integrated as a lazy-loaded UI component, included in the Clerk UI contexts, and exposed via updated type definitions with TaskSelectOrganizationProps and a corresponding context type. The session tasks navigation logic is simplified by removing explicit navigation state and replacing direct session task calls with an internal Clerk navigation method. The organization selection task component is renamed from ForceOrganizationSelectionTask to TaskSelectOrganization and updated to use the new context. Supporting types, warnings, and exports are updated accordingly, including theme extensions and updated component export orders. Additionally, the deprecated ForceOrganizationSelectionTask component file is removed. A new higher-order component withTaskGuard is introduced to guard task components with redirect logic based on session state.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@LauraBeatris LauraBeatris force-pushed the laura/export-task-component branch from f8201ba to 504dc93 Compare July 22, 2025 22:10
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between fa67189 and 6254f92.

📒 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
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly 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
Use const assertions for literal types: as const
Use satisfies 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 ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly 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
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly 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
Use const assertions for literal types: as const
Use satisfies 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 ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly 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 and taskSelectOrganization property in the Appearance 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:

  1. Using a custom useSessionTasksContext() hook instead of raw useContext() for better abstraction
  2. Replacing nextTask with the more descriptive navigateToTaskIfAvailable() method name
  3. 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 and TaskSelectOrganizationContext 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 to TaskSelectOrganization 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 context
  • ctx?.appearance is safely passed to the OrganizationListContext.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 through navigateToTaskIfAvailable(). 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 TaskSelectOrganizationProps

The TaskSelectOrganizationProps type is declared in packages/types/src/clerk.ts but isn’t imported in packages/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 and useCallback 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 and redirectUrlComplete), which will prevent unnecessary re-renders and maintain performance.


32-32: Consistent context pattern.

The new TaskSelectOrganizationContext follows the same pattern as the existing SessionTasksContext, 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 and TaskSelectOrganizationContext follows the established import pattern and supports the nested provider structure needed for this component.


113-122: Nested TaskSelectOrganization and SessionTasks contexts are both required

Both 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 the AvailableComponentProps union maintains type safety and follows the established pattern.


141-143: LGTM! Context type follows established pattern.

The TaskSelectOrganizationCtx type correctly extends TaskSelectOrganizationProps with the required componentName property, following the same pattern used by other component context types.


175-175: LGTM! Union type completion is correct.

Adding TaskSelectOrganizationCtx to the AvailableComponentCtx 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 new navigateToTaskIfAvailable callback (internally wired to clerk.__internal_navigateToTaskIfAvailable), and no references to nextTask remain.
  • Although currentTaskContainer is now marked optional in the type, the provider always supplies a useRef<HTMLDivElement> instance, so existing consumers won’t encounter undefined at runtime.
packages/clerk-js/src/ui/components/SessionTasks/index.tsx (6)

3-3: LGTM! React imports updated correctly.

The removal of useCallback and useState 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() to navigateToTaskIfAvailable() 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 and currentTaskContainer, removing the nextTask 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 of ForceOrganizationSelection 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 remains ForceOrganizationSelection.tsx, but its export has been renamed to TaskSelectOrganization. No other code is importing the old component name, so no further changes are needed.

Likely an incorrect or invalid review comment.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6254f92 and 55eb835.

📒 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)

Copy link

pkg-pr-new bot commented Jul 22, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6376

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6376

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6376

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6376

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6376

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6376

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6376

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6376

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6376

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6376

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6376

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6376

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6376

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6376

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6376

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6376

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6376

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6376

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6376

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6376

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6376

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6376

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6376

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6376

commit: acac882

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 8145b48 and 13a3b39.

📒 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
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly 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
Use const assertions for literal types: as const
Use satisfies 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 ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly 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
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly 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
Use const assertions for literal types: as const
Use satisfies 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 ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly 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 and renderWhileLoading: 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.

@LauraBeatris LauraBeatris force-pushed the laura/export-task-component branch from 13a3b39 to de3a2bb Compare July 22, 2025 23:27
@iagodahlem
Copy link
Member

!snapshot

Copy link
Member

@iagodahlem iagodahlem left a 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.

@LauraBeatris
Copy link
Member Author

@iagodahlem Good catch! I'll introduce a component guard for active sessions on TaskSelectOrganization

@LauraBeatris
Copy link
Member Author

!snapshot

@LauraBeatris LauraBeatris force-pushed the laura/export-task-component branch from b23d894 to e446bc9 Compare July 24, 2025 21:26
@clerk-cookie
Copy link
Collaborator

Hey @LauraBeatris - the snapshot version command generated the following package versions:

Package Version
@clerk/agent-toolkit 0.1.14-snapshot.v20250724212518
@clerk/astro 2.10.11-snapshot.v20250724212518
@clerk/backend 2.6.0-snapshot.v20250724212518
@clerk/chrome-extension 2.5.13-snapshot.v20250724212518
@clerk/clerk-js 5.77.0-snapshot.v20250724212518
@clerk/elements 0.23.46-snapshot.v20250724212518
@clerk/clerk-expo 2.14.12-snapshot.v20250724212518
@clerk/expo-passkeys 0.3.23-snapshot.v20250724212518
@clerk/express 1.7.13-snapshot.v20250724212518
@clerk/fastify 2.4.13-snapshot.v20250724212518
@clerk/localizations 3.20.4-snapshot.v20250724212518
@clerk/nextjs 6.27.0-snapshot.v20250724212518
@clerk/nuxt 1.7.14-snapshot.v20250724212518
@clerk/clerk-react 5.37.0-snapshot.v20250724212518
@clerk/react-router 1.8.7-snapshot.v20250724212518
@clerk/remix 4.10.7-snapshot.v20250724212518
@clerk/shared 3.15.1-snapshot.v20250724212518
@clerk/tanstack-react-start 0.21.3-snapshot.v20250724212518
@clerk/testing 1.10.7-snapshot.v20250724212518
@clerk/themes 2.4.2-snapshot.v20250724212518
@clerk/types 4.70.1-snapshot.v20250724212518
@clerk/vue 1.8.21-snapshot.v20250724212518

Tip: Use the snippet copy button below to quickly install the required packages.
@clerk/agent-toolkit

npm i @clerk/[email protected] --save-exact

@clerk/astro

npm i @clerk/[email protected] --save-exact

@clerk/backend

npm i @clerk/[email protected] --save-exact

@clerk/chrome-extension

npm i @clerk/[email protected] --save-exact

@clerk/clerk-js

npm i @clerk/[email protected] --save-exact

@clerk/elements

npm i @clerk/[email protected] --save-exact

@clerk/clerk-expo

npm i @clerk/[email protected] --save-exact

@clerk/expo-passkeys

npm i @clerk/[email protected] --save-exact

@clerk/express

npm i @clerk/[email protected] --save-exact

@clerk/fastify

npm i @clerk/[email protected] --save-exact

@clerk/localizations

npm i @clerk/[email protected] --save-exact

@clerk/nextjs

npm i @clerk/[email protected] --save-exact

@clerk/nuxt

npm i @clerk/[email protected] --save-exact

@clerk/clerk-react

npm i @clerk/[email protected] --save-exact

@clerk/react-router

npm i @clerk/[email protected] --save-exact

@clerk/remix

npm i @clerk/[email protected] --save-exact

@clerk/shared

npm i @clerk/[email protected] --save-exact

@clerk/tanstack-react-start

npm i @clerk/[email protected] --save-exact

@clerk/testing

npm i @clerk/[email protected] --save-exact

@clerk/themes

npm i @clerk/[email protected] --save-exact

@clerk/types

npm i @clerk/[email protected] --save-exact

@clerk/vue

npm i @clerk/[email protected] --save-exact

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 ?. on ctx?.appearance is redundant.

-        appearance: ctx?.appearance,
+        appearance: ctx.appearance,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4281d4c and acac882.

📒 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
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly 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
Use const assertions for literal types: as const
Use satisfies 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 ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly 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:

  1. withCardStateProvider - provides card state context
  2. withTaskGuard - ensures task exists before rendering
  3. withCoreSessionSwitchGuard - provides session switch protection

Since 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.

@LauraBeatris LauraBeatris merged commit b0fdc9e into main Jul 24, 2025
36 checks passed
@LauraBeatris LauraBeatris deleted the laura/export-task-component branch July 24, 2025 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants