-
Notifications
You must be signed in to change notification settings - Fork 419
feat(ui): Simplify chunk config, optimize modal initialization #7451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: cf8053e The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the WalkthroughAdding RsDoctor build diagnostics integration to the rspack configuration with a conditional Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
packages/ui/package.json (1)
51-51: Consider cross-platform compatibility for the environment variable.The
RSDOCTOR=truesyntax 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 usingcross-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-envas 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.
📒 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.tsxpackages/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.tsxpackages/ui/rspack.config.jspackages/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.tsxpackages/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
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Implement type guards forunknowntypes using the patternfunction isType(value: unknown): value is Type
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details in classes
Useprotectedfor inheritance hierarchies
Usepublicexplicitly 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 likeOmit,Partial, andPickfor 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
Useconst assertionswithas constfor literal types
Usesatisfiesoperator 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.tsxpackages/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.tsxpackages/ui/rspack.config.jspackages/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 packagesAll packages must be published under @clerk namespace
packages/*/package.json: Framework packages should depend on@clerk/clerk-jsfor core functionality
@clerk/sharedshould 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/uiaffect the published package behavior (even if internal), a proper changeset entry should be added:--- '@clerk/ui': patch --- Simplify chunk config and optimize modal initializationIf 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
testfunction properly filters modules for the common cache group by:
- Ensuring the module is a
NormalModuleinstance- Excluding files under
/componentspathsThis 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-pluginin normal builds while enabling it whenRSDOCTOR=trueis set. The plugin configuration withgenerateTileGraphand disabledecma-version-checklint 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: falseprevents 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
WaitlistModalon line 495 receives{...waitlistModal}, butwaitlistModalcould benullwhensignInModalis open. Spreadingnullis safe (results in no props), but the component may expect actual props.Similarly,
SignUpModalreceives disambiguated props which is correct for cross-modal navigation.Is it intentional that
WaitlistModalinsideSignInModal'sLazyModalRendererreceives 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
modalContainerSxandmodalContentSx. The__experimental_startPathfallback tourlStateParam?.pathis 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,
SignInModalreceives{...waitlistModal}props. This seems inconsistent -SignInModalwould typically expectSignInProps, notWaitlistProps. 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: hiddenandpointerEvents: nonefor CAPTCHA handling is correctly configured withcanCloseModal={false}to prevent user dismissal.
@clerk/agent-toolkit
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/dev-cli
@clerk/expo
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
Description
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.