Skip to content

Conversation

@brkalow
Copy link
Member

@brkalow brkalow commented Dec 13, 2025

Description

  • Remove chunk config to prevent sign up chunk from being loaded when it isn't needed
  • Optimize initialization of modals to reduce unnecessary invocations

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

  • Chores
    • Integrated diagnostic build tooling to enhance development workflows and troubleshooting capabilities
    • Refactored internal component rendering architecture for improved code maintainability
    • Optimized build configuration and development server settings for better developer experience

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot
Copy link

changeset-bot bot commented Dec 13, 2025

🦋 Changeset detected

Latest commit: cf8053e

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

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@vercel
Copy link

vercel bot commented Dec 13, 2025

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

Project Deployment Review Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Dec 13, 2025 6:50am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 13, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Adding RsDoctor build diagnostics integration to the rspack configuration with a conditional build:rsdoctor command. Refactoring rspack.config.js to be asynchronous with plugin integration and enhanced dev server configuration. Inlining modal component rendering in Components.tsx to eliminate intermediate mounted variables.

Changes

Cohort / File(s) Summary
Build Configuration & Dependencies
packages/ui/package.json, packages/ui/rspack.config.js
Added build:rsdoctor command and @rsdoctor/rspack-plugin dev dependency. Refactored rspack config to async, conditionally integrating RsDoctor plugin based on RSDOCTOR env var. Removed SignUp cache group, tightened common chunking test. Enhanced dev server with error/warning overlay and runtimeErrors flag.
Changeset
.changeset/chatty-papers-obey.md
Added formatting lines (dashes) to changeset entry.
Component Refactoring
packages/ui/src/Components.tsx
Inlined modal component rendering directly within JSX, removing separate mountedXModal variable declarations for SignIn, SignUp, UserProfile, UserVerification, OrganizationProfile, CreateOrganization, Waitlist, BlankCaptcha, and GoogleOneTap modals.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • packages/ui/rspack.config.js: Requires careful review of async conversion logic, conditional RsDoctor plugin loading, and dev server overlay configuration changes
  • packages/ui/src/Components.tsx: Verify modal rendering refactoring maintains functional equivalence and proper event handler binding across all 9 modal components
  • packages/ui/package.json: Confirm new dependency version and build command syntax

Poem

🐰 A builder's tale in configs bright,
RsDoctor shines—diagnostics in sight!
Modals now dance where they're meant to be,
Inlined and swift, a refactor spree! 🚀

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: simplifying chunk configuration and optimizing modal initialization, which aligns with the PR objectives and file-level changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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

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

🧹 Nitpick comments (1)
packages/ui/package.json (1)

51-51: Consider cross-platform compatibility for the environment variable.

The RSDOCTOR=true syntax works on Unix-based systems but will fail on Windows. Since this is a dev-only diagnostic script, this may be acceptable, but if Windows developers need it, consider using cross-env.

-    "build:rsdoctor": "RSDOCTOR=true rspack build --config rspack.config.js --env production",
+    "build:rsdoctor": "cross-env RSDOCTOR=true rspack build --config rspack.config.js --env production",

Note: This would require adding cross-env as a devDependency.

📜 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 1eaef8e and 074f96d.

📒 Files selected for processing (4)
  • .changeset/chatty-papers-obey.md (1 hunks)
  • packages/ui/package.json (2 hunks)
  • packages/ui/rspack.config.js (5 hunks)
  • packages/ui/src/Components.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (14)
**/*.{js,jsx,ts,tsx}

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

All code must pass ESLint checks with the project's configuration

Files:

  • packages/ui/src/Components.tsx
  • packages/ui/rspack.config.js
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}

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

Use Prettier for consistent code formatting

Files:

  • packages/ui/src/Components.tsx
  • packages/ui/rspack.config.js
  • packages/ui/package.json
packages/**/src/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/ui/src/Components.tsx
**/*.{ts,tsx,js,jsx}

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

Follow established naming conventions (PascalCase for components, camelCase for variables)

Files:

  • packages/ui/src/Components.tsx
  • packages/ui/rspack.config.js
packages/**/src/**/*.{ts,tsx,js,jsx}

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

packages/**/src/**/*.{ts,tsx,js,jsx}: Maintain comprehensive JSDoc comments for public APIs
Use tree-shaking friendly exports
Validate all inputs and sanitize outputs
All public APIs must be documented with JSDoc
Use dynamic imports for optional features
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
Implement proper logging with different levels

Files:

  • packages/ui/src/Components.tsx
**/*.ts?(x)

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

Use proper TypeScript error types

Files:

  • packages/ui/src/Components.tsx
**/*.tsx

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

**/*.tsx: Use error boundaries in React components
Minimize re-renders in React components

**/*.tsx: Use proper type definitions for props and state in React components
Leverage TypeScript's type inference where possible in React components
Use proper event types for handlers in React components
Implement proper generic types for reusable React components
Use proper type guards for conditional rendering in React components

Files:

  • packages/ui/src/Components.tsx
**/*.{md,tsx}

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

Update documentation for API changes

Files:

  • packages/ui/src/Components.tsx
**/*.{jsx,tsx}

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

**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components (e.g., 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
Separate UI components from business logic components
Use useState for simple state management in React components
Use useReducer for complex state logic in React components
Implement proper state initialization in React components
Use proper state updates with callbacks in React components
Implement proper state cleanup in React components
Use Context API for theme/authentication state management
Implement proper state persistence in React applications
Use React.memo for expensive components
Implement proper useCallback for handlers in React components
Use proper useMemo for expensive computations in React components
Implement proper virtualization for lists in React components
Use proper code splitting with React.lazy in React applications
Implement proper cleanup in useEffect hooks
Use proper refs for DOM access in React components
Implement proper event listener cleanup in React components
Use proper abort controllers for fetch in React components
Implement proper subscription cleanup in React components
Use proper HTML elements for semantic HTML in React components
Implement proper ARIA attributes for accessibility in React components
Use proper heading hierarchy in React components
Implement proper form labels in React components
Use proper button types in React components
Implement proper focus management for keyboard navigation in React components
Use proper keyboard shortcuts in React components
Implement proper tab order in React components
Use proper ...

Files:

  • packages/ui/src/Components.tsx
**/*.{ts,tsx}

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

**/*.{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
Implement type guards for unknown types using the pattern function isType(value: unknown): value is Type
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 in classes
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Use mixins for shared behavior across unrelated classes in TypeScript
Use generic constraints with bounded type parameters like <T extends { id: string }>
Use utility types like Omit, Partial, and Pick for data transformation instead of manual type construction
Use discriminated unions instead of boolean flags for state management and API responses
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation at the type level
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Document functions with JSDoc comments including @param, @returns, @throws, and @example tags
Create custom error classes that extend Error for specific error types
Use the Result pattern for error handling instead of throwing exceptions
Use optional chaining (?.) and nullish coalescing (??) operators for safe property access
Let TypeScript infer obvious types to reduce verbosity
Use const assertions with as const for literal types
Use satisfies operator for type checking without widening types
Declare readonly arrays and objects for immutable data structures
Use spread operator and array spread for immutable updates instead of mutations
Use lazy loading for large types...

Files:

  • packages/ui/src/Components.tsx
**/*.{js,ts,jsx,tsx}

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

Use ESLint with custom configurations tailored for different package types

Files:

  • packages/ui/src/Components.tsx
  • packages/ui/rspack.config.js
**/*.{js,ts,jsx,tsx,json,md,yml,yaml}

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

Use Prettier for code formatting across all packages

Files:

  • packages/ui/src/Components.tsx
  • packages/ui/rspack.config.js
  • packages/ui/package.json
packages/*/package.json

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

packages/*/package.json: Packages should export TypeScript types alongside runtime code
Follow semantic versioning for all packages

All packages must be published under @clerk namespace

packages/*/package.json: Framework packages should depend on @clerk/clerk-js for core functionality
@clerk/shared should be a common dependency for most packages in the monorepo

Files:

  • packages/ui/package.json
**/package.json

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

Use pnpm as the package manager for this monorepo

Files:

  • packages/ui/package.json
🧬 Code graph analysis (1)
packages/ui/src/Components.tsx (2)
packages/ui/src/lazyModules/providers.tsx (2)
  • LazyOneTapRenderer (246-261)
  • LazyModalRenderer (119-155)
packages/ui/src/lazyModules/components.ts (7)
  • SignInModal (38-38)
  • SignUpModal (57-57)
  • UserProfileModal (71-73)
  • UserVerificationModal (47-49)
  • OrganizationProfileModal (87-89)
  • CreateOrganizationModal (79-81)
  • BlankCaptchaModal (105-107)
🪛 GitHub Actions: CI
packages/ui/package.json

[error] 1-1: Command failed: pnpm install. ERR_PNPM_OUTDATED_LOCKFILE: Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with /packages/ui/package.json. specifiers in the lockfile don't match specifiers in package.json: 1 dependencies were added: @rsdoctor/rspack-plugin@^1.0.5. Update the lockfile or run without --frozen-lockfile (e.g., pnpm install) to resolve.

⏰ 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). (2)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (13)
.changeset/chatty-papers-obey.md (1)

1-2: Empty changeset file.

This changeset has no package entries or description. If the modal optimization and chunk config changes in @clerk/ui affect the published package behavior (even if internal), a proper changeset entry should be added:

---
'@clerk/ui': patch
---

Simplify chunk config and optimize modal initialization

If these are purely build-time/dev-only changes with no impact on the published artifact, this empty changeset is acceptable.

packages/ui/rspack.config.js (3)

65-66: Chunk optimization looks correct.

The tightened test function properly filters modules for the common cache group by:

  1. Ensuring the module is a NormalModule instance
  2. Excluding files under /components paths

This aligns with the PR objective to prevent unnecessary chunk loading (e.g., sign-up chunk when not needed).


139-167: LGTM on async production config with conditional RsDoctor integration.

The dynamic import pattern correctly avoids bundling @rsdoctor/rspack-plugin in normal builds while enabling it when RSDOCTOR=true is set. The plugin configuration with generateTileGraph and disabled ecma-version-check lint rule is appropriate for build diagnostics.


204-211: Dev server overlay configuration enhancement.

The added client overlay configuration for errors/warnings and disabling runtime errors overlay is a reasonable DX improvement. Setting runtimeErrors: false prevents noisy overlays from transient runtime issues during development.

packages/ui/src/Components.tsx (9)

473-480: LGTM on GoogleOneTap modal rendering.

The inline conditional rendering is cleaner and correctly passes the component props and appearance configuration.


482-497: Verify props passed to nested modals.

The WaitlistModal on line 495 receives {...waitlistModal}, but waitlistModal could be null when signInModal is open. Spreading null is safe (results in no props), but the component may expect actual props.

Similarly, SignUpModal receives disambiguated props which is correct for cross-modal navigation.

Is it intentional that WaitlistModal inside SignInModal's LazyModalRenderer receives potentially null props? This suggests the nested modal is a navigation target that will receive props later when navigated to.


499-514: Consistent pattern with SignUpModal.

Same pattern as SignInModal - nested modals for in-modal navigation with disambiguated redirect options. Looks correct.


516-534: LGTM on UserProfileModal rendering.

Properly configured with custom modal sizing via modalContainerSx and modalContentSx. The __experimental_startPath fallback to urlStateParam?.path is handled correctly.


536-550: LGTM on UserVerificationModal rendering.

Correctly configured with appearance, flow name, and close handlers.


552-570: LGTM on OrganizationProfileModal rendering.

Same pattern with experimental start path support and custom modal sizing.


572-587: LGTM on CreateOrganizationModal rendering.

Correctly configured with custom modal sizing.


589-603: Verify SignInModal props inside WaitlistModal.

On line 601, SignInModal receives {...waitlistModal} props. This seems inconsistent - SignInModal would typically expect SignInProps, not WaitlistProps. This might cause type mismatches or unexpected behavior.

Was this intentional? Should it be disambiguated similar to how it's done in the SignIn/SignUp modal renderers?

-            <SignInModal {...waitlistModal} />
+            <SignInModal {...disambiguateRedirectOptions(waitlistModal, 'waitlist')} />

605-620: LGTM on BlankCaptchaModal rendering.

The hidden modal with visibility: hidden and pointerEvents: none for CAPTCHA handling is correctly configured with canCloseModal={false} to prevent user dismissal.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Dec 13, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

npm i https://pkg.pr.new/@clerk/ui@7451

@clerk/upgrade

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

@clerk/vue

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

commit: cf8053e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants