Skip to content

Conversation

LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Oct 1, 2025

Description

Resolves ORGS-886

Conditionally display the organization slug field based on instance organization settings. Also, deprecates the hideSlug prop in favor of the runtime setting.

CleanShot.2025-10-02.at.14.27.25.mp4

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

    • Organization slug visibility and inclusion in create flows now honor environment settings.
  • Documentation

    • hideSlug prop marked deprecated; slug behavior should be configured via the Clerk Dashboard.
    • Public types and organization settings now expose slug.disabled.
  • Tests

    • Fixtures and tests expanded to cover slug-enabled and slug-disabled scenarios.
  • Chores

    • Dependency patch updates and accompanying changeset added.

@LauraBeatris LauraBeatris self-assigned this Oct 1, 2025
Copy link

changeset-bot bot commented Oct 1, 2025

🦋 Changeset detected

Latest commit: bd59a62

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 Patch
@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 Oct 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Oct 3, 2025 4:32pm

Copy link
Contributor

coderabbitai bot commented Oct 1, 2025

Walkthrough

Reads organization slug visibility from environment settings, adds slug.disabled to organization settings types and resource, conditions UI rendering and create params on that flag, updates fixtures/helpers/tests, adds a changeset, and marks the hideSlug prop as deprecated.

Changes

Cohort / File(s) Summary of changes
Changeset
.changeset/dull-paws-march.md
Added changeset documenting dependency bumps and noting organization slug display is driven by environment settings.
Organization settings model & resource
packages/clerk-js/src/core/resources/OrganizationSettings.ts
Added public slug: { disabled: boolean } property (default { disabled: false }) and updated fromJSON to populate slug.disabled when provided.
Types: organization settings
packages/types/src/organizationSettings.ts
Added slug: { disabled: boolean } to OrganizationSettingsJSON and OrganizationSettingsResource interfaces.
Types: public props deprecation
packages/types/src/clerk.ts
Marked hideSlug props as deprecated in documentation for multiple public props (signatures remain boolean).
CreateOrganization UI
packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
Use useEnvironment to read organizationSettings; compute organizationSlugEnabled = !organizationSettings.slug.disabled && !props.hideSlug; conditionally render slug input and add slug to create params when enabled; added deprecation note for hideSlug prop.
SessionTasks Create screen
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
Read organizationSettings from environment; compute organizationSlugEnabled; conditionally render slug input and include slug in createOrganization params only when enabled; typed createOrganization params.
Test fixtures & helpers
packages/clerk-js/src/test/fixtures.ts, packages/clerk-js/src/test/fixture-helpers.ts
Base org settings fixture now includes slug: { disabled: true }; added withOrganizationSlug(enabled?: boolean) fixture helper and exposed it from createOrganizationSettingsFixtureHelpers.
CreateOrganization tests
packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
Reorganized tests into contexts and added scenarios verifying slug field rendered/hidden depending on environment and hideSlug; adjusted mocks/fixtures and assertions for navigation to Invite flow.
TaskChooseOrganization tests
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
Added tests asserting slug field visibility toggled by environment using `withOrganizationSlug(true
OrganizationList tests
packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
Enabled slug behavior in fixtures (f.withOrganizationSlug(true)) for relevant test scenarios.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant UI as CreateOrganization UI
  participant Env as Environment
  participant API as Organizations API

  User->>UI: Open create org form
  UI->>Env: Read organizationSettings.slug.disabled
  Env-->>UI: { slug: { disabled: true|false } }

  alt Slug enabled (disabled = false)
    UI->>User: Render Name + Slug inputs
    User->>UI: Submit { name, slug }
    UI->>API: createOrganization({ name, slug })
    API-->>UI: Organization created
  else Slug disabled (disabled = true)
    UI->>User: Render Name input only
    User->>UI: Submit { name }
    UI->>API: createOrganization({ name })
    API-->>UI: Organization created
  end

  UI-->>User: Proceed to next step (Invite members)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my nose at envs that say,
"Hide my slug" or "show today."
If flagged off, I skip that line,
If flagged on, the slug will shine.
Tests hop through fields — all set to play! 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately summarizes the main change by indicating that the feature adds environment-based slug display support in both clerk-js and types packages, clearly reflecting the core objective of the pull request. It follows the conventional “feat(...): …” format, names the affected modules, and concisely conveys the purpose without extraneous detail.
Linked Issues Check ✅ Passed The implementation adds a slug.disabled flag to organization settings, updates UI components to conditionally render the slug field based on that flag, deprecates the hideSlug prop in public type definitions, and extends tests and fixtures to cover these scenarios, fully satisfying the ORGS-886 objectives.
Out of Scope Changes Check ✅ Passed All code changes pertain directly to the addition and handling of the organization slug feature—updating types, UI logic, fixtures, tests, and version bumps—and there are no modifications unrelated to the linked issue’s goals.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch laura/add-slugs-to-environment-settings

Comment @coderabbitai help to get the list of available commands and usage tips.

@LauraBeatris LauraBeatris changed the title Laura/add slugs to environment settings [wip] feat(clerk-js): Display organization slug based on environment settings Oct 1, 2025
@LauraBeatris LauraBeatris requested a review from a team October 1, 2025 22:54
@LauraBeatris LauraBeatris force-pushed the laura/add-slugs-to-environment-settings branch from ea4effd to 9b9b59b Compare October 1, 2025 23:21
@LauraBeatris LauraBeatris force-pushed the laura/add-slugs-to-environment-settings branch from 9b9b59b to 316c650 Compare October 1, 2025 23:26
@LauraBeatris LauraBeatris marked this pull request as ready for review October 1, 2025 23:41
@LauraBeatris LauraBeatris changed the title [wip] feat(clerk-js): Display organization slug based on environment settings feat(clerk-js): Display organization slug based on environment settings Oct 1, 2025
@LauraBeatris LauraBeatris changed the title feat(clerk-js): Display organization slug based on environment settings feat(clerk-js,types): Display organization slug based on environment settings Oct 1, 2025
Copy link

pkg-pr-new bot commented Oct 1, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: bd59a62

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: 3

🧹 Nitpick comments (1)
packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1)

83-115: Good test structure for backward compatibility.

The test correctly validates that the deprecated hideSlug prop still functions as expected, ensuring backward compatibility. The test verifies both the absence of the slug field and the successful flow to the invitation screen.

However, consider adding a test case that validates the interaction between hideSlug prop and environment settings to ensure the intended priority/combination behavior is correct (e.g., when hideSlug=false but environment has slug.disabled=true).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6ea39ae and 754502a.

📒 Files selected for processing (10)
  • .changeset/dull-paws-march.md (1 hunks)
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts (2 hunks)
  • packages/clerk-js/src/test/fixture-helpers.ts (1 hunks)
  • packages/clerk-js/src/test/fixtures.ts (1 hunks)
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx (5 hunks)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx (1 hunks)
  • packages/types/src/clerk.ts (3 hunks)
  • packages/types/src/organizationSettings.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{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/organizationSettings.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/test/fixtures.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/organizationSettings.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/test/fixtures.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/types/src/organizationSettings.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/test/fixtures.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/organizationSettings.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/test/fixtures.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/organizationSettings.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/test/fixtures.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/organizationSettings.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/test/fixtures.ts
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/dull-paws-march.md
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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
packages/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Unit tests should use Jest or Vitest as the test runner.

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Visual regression testing should be performed for UI components.

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
**/*.test.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

**/*.test.{jsx,tsx}: Use React Testing Library
Test component behavior, not implementation
Use proper test queries
Implement proper test isolation
Use proper test coverage
Test component interactions
Use proper test data
Implement proper test setup
Use proper test cleanup
Implement proper test assertions
Use proper test structure

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
**/__tests__/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/__tests__/**/*.{ts,tsx}: Create type-safe test builders/factories
Use branded types for test isolation
Implement proper mock types that match interfaces

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
🧬 Code graph analysis (1)
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx (1)
packages/types/src/clerk.ts (1)
  • CreateOrganizationParams (2128-2137)
⏰ 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). (29)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Static analysis
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (14)
packages/types/src/clerk.ts (1)

1564-1568: LGTM! Deprecation notices are clear and consistent.

The three deprecation notices for hideSlug prop across CreateOrganizationProps, OrganizationSwitcherProps, and OrganizationListProps are well-documented and guide users to configure slug behavior via the Clerk Dashboard. The type signatures remain unchanged, ensuring backward compatibility.

Also applies to: 1725-1729, 1786-1790

.changeset/dull-paws-march.md (1)

1-7: LGTM! Changeset properly documents the behavioral change.

The changeset correctly identifies both affected packages and provides a clear description of the feature.

packages/clerk-js/src/test/fixtures.ts (1)

92-94: Verify the default disabled: true aligns with test intent.

The fixture sets slug.disabled: true by default, whereas the runtime OrganizationSettings class defaults to { disabled: false } (Line 24 in packages/clerk-js/src/core/resources/OrganizationSettings.ts). This means tests will default to slug-disabled unless explicitly enabled via withOrganizationSlug(true).

Confirm this mismatch is intentional—if most tests should validate slug-enabled behavior, consider defaulting to disabled: false in the fixture and overriding in specific tests.

packages/types/src/organizationSettings.ts (1)

20-22: LGTM! Type definitions are consistent and match implementation.

The slug: { disabled: boolean } property is correctly added to both OrganizationSettingsJSON and OrganizationSettingsResource interfaces, aligning with the runtime implementation in OrganizationSettings.ts.

Also applies to: 37-39

packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx (2)

82-82: Consider validating slug field when organization slug is enabled.

Currently, isSubmitButtonDisabled only checks nameField.value. When organizationSlugEnabled is true, the slug input is marked as isRequired (Line 109), but the submit button doesn't validate it.

Verify whether the slug field should be validated before submission, or confirm that backend validation is sufficient.

const isSubmitButtonDisabled = !nameField.value || (organizationSlugEnabled && !slugField.value) || !isLoaded;

2-2: LGTM! Environment-driven slug behavior correctly implemented.

The component properly:

  • Reads organizationSettings from environment
  • Derives organizationSlugEnabled from !organizationSettings.slug.disabled
  • Conditionally includes slug in createOrgParams only when enabled
  • Conditionally renders slug input based on the flag

Also applies to: 4-4, 30-30, 43-43, 53-59, 104-114

packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx (1)

208-224: LGTM! Environment-driven slug visibility tests are well-structured.

The test properly validates that the slug field is hidden when withOrganizationSlug(false) is used in the fixture.

packages/clerk-js/src/test/fixture-helpers.ts (1)

345-347: LGTM! Fixture helper correctly implements slug toggling.

The withOrganizationSlug helper properly sets os.slug.disabled = !enabled and is correctly exported in the return object, enabling tests to configure environment-based slug behavior.

Also applies to: 354-360

packages/clerk-js/src/core/resources/OrganizationSettings.ts (2)

21-25: LGTM! Slug property correctly initialized and deserialized.

The slug property:

  • Defaults to { disabled: false } (slug enabled by default)
  • Is properly populated in fromJSON using the existing withDefault pattern
  • Follows the same structure as other organization settings properties

Also applies to: 50-52


64-76: Verify intentional exclusion of slug from snapshot.

The __internal_toSnapshot() method does not include the slug property in the serialized snapshot. If slug settings should persist across snapshot restoration, consider adding:

 public __internal_toSnapshot(): OrganizationSettingsJSONSnapshot {
   return {
     actions: {
       admin_delete: this.actions.adminDelete,
     },
     domains: {
       enabled: this.domains.enabled,
       enrollment_modes: this.domains.enrollmentModes,
       default_role: this.domains.defaultRole,
     },
+    slug: {
+      disabled: this.slug.disabled,
+    },
     enabled: this.enabled,
     max_allowed_memberships: this.maxAllowedMemberships,
   } as unknown as OrganizationSettingsJSONSnapshot;
 }

Confirm whether this exclusion is intentional based on snapshot requirements.

packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx (3)

5-5: LGTM!

The import of useEnvironment is correctly added to access organization settings from the runtime environment.


37-42: LGTM!

The deprecation notice is clear and provides appropriate migration guidance directing users to configure organization slug settings via the Clerk Dashboard.


86-88: Usages are correct, pending logic fix.

The conditional inclusion of slug in create parameters (line 86) and conditional rendering of the slug input field (line 199) are implemented correctly. However, they depend on the organizationSlugEnabled flag computed at line 71, which contains a critical logic error that must be fixed first.

Also applies to: 199-209

packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1)

68-82: LGTM!

The existing test cases for basic rendering, invitation screen behavior, and navigation remain intact and unaffected by the slug-related changes. Good isolation of changes.

Also applies to: 151-232

@LauraBeatris
Copy link
Member Author

Some unit tests are failing - I'll take a look into it ASAP.

@LauraBeatris LauraBeatris marked this pull request as draft October 2, 2025 08:33
@LauraBeatris LauraBeatris reopened this Oct 2, 2025
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 (1)
packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1)

182-206: Clarify test description to match expectation

The test name claims the slug field renders, but the assertion verifies it stays hidden. Renaming the spec (or tweaking the description) will keep expectations clear for future readers.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 754502a and 2d6d999.

📒 Files selected for processing (10)
  • .changeset/dull-paws-march.md (1 hunks)
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts (2 hunks)
  • packages/clerk-js/src/test/fixture-helpers.ts (1 hunks)
  • packages/clerk-js/src/test/fixtures.ts (1 hunks)
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx (6 hunks)
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx (5 hunks)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx (1 hunks)
  • packages/types/src/clerk.ts (3 hunks)
  • packages/types/src/organizationSettings.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/types/src/clerk.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/types/src/organizationSettings.ts
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/tests/TaskChooseOrganization.test.tsx
🧰 Additional context used
📓 Path-based instructions (14)
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/dull-paws-march.md
**/*.{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/test/fixtures.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.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/test/fixtures.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/test/fixtures.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.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/test/fixtures.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.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/test/fixtures.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.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/test/fixtures.ts
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
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/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.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/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.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/CreateOrganization/CreateOrganizationForm.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
packages/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Unit tests should use Jest or Vitest as the test runner.

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Visual regression testing should be performed for UI components.

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
**/*.test.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

**/*.test.{jsx,tsx}: Use React Testing Library
Test component behavior, not implementation
Use proper test queries
Implement proper test isolation
Use proper test coverage
Test component interactions
Use proper test data
Implement proper test setup
Use proper test cleanup
Implement proper test assertions
Use proper test structure

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
**/__tests__/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/__tests__/**/*.{ts,tsx}: Create type-safe test builders/factories
Use branded types for test isolation
Implement proper mock types that match interfaces

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
🧬 Code graph analysis (1)
packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx (1)
packages/types/src/clerk.ts (1)
  • CreateOrganizationParams (2128-2137)
⏰ 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: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: semgrep-cloud-platform/scan

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: 2

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2d6d999 and 2ddbfdb.

📒 Files selected for processing (3)
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx (2 hunks)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/tests/TaskChooseOrganization.test.tsx
🧰 Additional context used
📓 Path-based instructions (13)
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/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
packages/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Unit tests should use Jest or Vitest as the test runner.

Files:

  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Visual regression testing should be performed for UI components.

Files:

  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
**/*.test.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

**/*.test.{jsx,tsx}: Use React Testing Library
Test component behavior, not implementation
Use proper test queries
Implement proper test isolation
Use proper test coverage
Test component interactions
Use proper test data
Implement proper test setup
Use proper test cleanup
Implement proper test assertions
Use proper test structure

Files:

  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
**/__tests__/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/__tests__/**/*.{ts,tsx}: Create type-safe test builders/factories
Use branded types for test isolation
Implement proper mock types that match interfaces

Files:

  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
⏰ 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). (6)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx (1)

6-6: LGTM!

Consolidating the import at the top of the file improves code organization and follows standard import conventions.

packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1)

83-115: Good refactoring for test organization.

Wrapping the existing hideSlug prop test in a dedicated describe block improves test readability and clearly separates prop-based behavior from environment-based behavior. This aligns with the deprecation strategy where both mechanisms coexist during the transition period.

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/CreateOrganization/__tests__/CreateOrganization.test.tsx (2)

83-114: Ensure hideSlug test isolates the prop behavior

Right now the "with hideSlug prop" test never enables slug via the environment fixture. If the default environment already has slug disabled, this test will pass even if the prop stops working. Please force the environment to expose the slug (so the prop is the only factor hiding it) before asserting on the field.

       const { wrapper, fixtures, props } = await createFixtures(f => {
         f.withOrganizations();
+        f.withOrganizationSlug(true);
         f.withUser({
           email_addresses: ['[email protected]'],
         });
       });

182-213: Rename test to reflect the expectation

The test name says it “renders component slug field,” but the assertions check that the slug field is absent. Please tweak the description so it matches the behavior under test.

-    it('when enabled and `hideSlug` prop is passed, renders component slug field', async () => {
+    it('when enabled and `hideSlug` prop is passed, renders component without slug field', async () => {
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2ddbfdb and 7c75955.

📒 Files selected for processing (3)
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/tests/TaskChooseOrganization.test.tsx
🧰 Additional context used
📓 Path-based instructions (13)
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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
packages/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Unit tests should use Jest or Vitest as the test runner.

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Visual regression testing should be performed for UI components.

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
**/*.test.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

**/*.test.{jsx,tsx}: Use React Testing Library
Test component behavior, not implementation
Use proper test queries
Implement proper test isolation
Use proper test coverage
Test component interactions
Use proper test data
Implement proper test setup
Use proper test cleanup
Implement proper test assertions
Use proper test structure

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
**/__tests__/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/__tests__/**/*.{ts,tsx}: Create type-safe test builders/factories
Use branded types for test isolation
Implement proper mock types that match interfaces

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx
⏰ 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). (31)
  • GitHub Check: Static analysis
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan

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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between aed42d2 and 5ab19a9.

📒 Files selected for processing (3)
  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationList/__tests__/OrganizationList.test.tsx (3 hunks)
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/src/ui/components/OrganizationList/tests/OrganizationList.test.tsx
  • packages/clerk-js/src/ui/components/SessionTasks/tasks/TaskChooseOrganization/tests/TaskChooseOrganization.test.tsx
🧰 Additional context used
📓 Path-based instructions (13)
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/CreateOrganization/__tests__/CreateOrganization.test.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/CreateOrganization/__tests__/CreateOrganization.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/CreateOrganization/__tests__/CreateOrganization.test.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/CreateOrganization/__tests__/CreateOrganization.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
packages/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Unit tests should use Jest or Vitest as the test runner.

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
packages/{clerk-js,elements,themes}/**/*.{test,spec}.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Visual regression testing should be performed for UI components.

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.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/CreateOrganization/__tests__/CreateOrganization.test.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/CreateOrganization/__tests__/CreateOrganization.test.tsx
**/*.test.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/react.mdc)

**/*.test.{jsx,tsx}: Use React Testing Library
Test component behavior, not implementation
Use proper test queries
Implement proper test isolation
Use proper test coverage
Test component interactions
Use proper test data
Implement proper test setup
Use proper test cleanup
Implement proper test assertions
Use proper test structure

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
**/__tests__/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/typescript.mdc)

**/__tests__/**/*.{ts,tsx}: Create type-safe test builders/factories
Use branded types for test isolation
Implement proper mock types that match interfaces

Files:

  • packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx
⏰ 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: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (4)
packages/clerk-js/src/ui/components/CreateOrganization/__tests__/CreateOrganization.test.tsx (4)

83-115: LGTM! Test reorganization improves clarity.

The existing hideSlug prop test is now properly organized under its own describe block, making the test suite structure clearer. The test correctly validates that when hideSlug is true, the slug field is hidden and the user can proceed to the invite flow.


117-148: LGTM! Environment-disabled slug test is thorough.

The test correctly validates that when the environment disables the slug field via withOrganizationSlug(false), the slug field is hidden and the create organization flow completes successfully to the invite screen.


150-180: LGTM! Environment-enabled slug test validates expected behavior.

The test correctly validates that when the environment enables the slug field via withOrganizationSlug(true), the slug field is visible and the create organization flow completes successfully.


215-246: LGTM! Complete test coverage achieved.

This test addresses the missing scenario from the previous review feedback, validating that when both the environment and the hideSlug prop disable the slug field, the component behaves correctly without conflicts. This completes the test matrix for all combinations of environment settings and the hideSlug prop.

Based on learnings from past review comments.

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.

🚀

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

♻️ Duplicate comments (2)
packages/types/src/clerk.ts (2)

1725-1727: Same deprecation clarity issue as CreateOrganizationProps.

This deprecation message has the same clarity gaps as the one at lines 1564-1566. Apply the same enhancement for consistency across all three deprecated hideSlug props.


1786-1788: Same deprecation clarity issue as CreateOrganizationProps.

This deprecation message has the same clarity gaps as the one at lines 1564-1566. Apply the same enhancement for consistency across all three deprecated hideSlug props.

🧹 Nitpick comments (1)
packages/types/src/clerk.ts (1)

1564-1566: Clarify deprecation message with transition behavior and precedence.

The deprecation notice should specify what happens when both hideSlug prop and the environment setting are present during the transition period. Based on the related changes in clerk-js (where organizationSlugEnabled is computed from both values), it appears the prop still has effect alongside the environment setting.

Consider enhancing the deprecation message to:

  1. Explain the precedence/interaction between the prop and environment setting during the transition
  2. Provide a timeline or version number for removal
  3. Include a link to migration documentation

Example enhancement:

  /**
-  * @deprecated
-  * This prop will be removed in a future version.
-  * Configure whether organization slug is enabled via the Clerk Dashboard under Organization Settings.
+  * @deprecated This prop will be removed in a future major version.
+  * During the transition period, this prop takes precedence over the Dashboard configuration when explicitly set.
+  * Configure organization slug visibility via the Clerk Dashboard under Organization Settings instead.
+  * See migration guide: https://clerk.com/docs/organizations/slug-configuration
   */
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 9114833 and bd59a62.

📒 Files selected for processing (2)
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx (6 hunks)
  • packages/types/src/clerk.ts (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/clerk-js/src/ui/components/CreateOrganization/CreateOrganizationForm.tsx
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{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/clerk.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/clerk.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/types/src/clerk.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/clerk.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/clerk.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/clerk.ts
⏰ 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). (6)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan

@LauraBeatris
Copy link
Member Author

Blocking merging this for a bit more.

I'll have to deploy some Dashboard changes on the copy of the organization settings page, and then enable the feature flag on production as well.

@LauraBeatris LauraBeatris merged commit fba4781 into main Oct 6, 2025
43 checks passed
@LauraBeatris LauraBeatris deleted the laura/add-slugs-to-environment-settings branch October 6, 2025 16:44
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