-
Notifications
You must be signed in to change notification settings - Fork 420
feat(ui,clerk-js,shared): Surface organization creation defaults #7488
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?
feat(ui,clerk-js,shared): Surface organization creation defaults #7488
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 3f86a35 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
81ea1f2 to
12005fb
Compare
21f7045 to
7093f4b
Compare
5393111 to
97c7605
Compare
97c7605 to
c5fcb39
Compare
13af5ff to
22edba6
Compare
| actionText: 'Signed in as {{identifier}}', | ||
| }, | ||
| alerts: { | ||
| organizationAlreadyExists: |
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.
Let's also include the company name:
An organization already exists for the detected company name (Clerk) and domain (clerk.dev). Join by invitation
| <FormContainer sx={t => ({ padding: `${t.space.$none} ${t.space.$10} ${t.space.$8}` })}> | ||
| <Form.Root onSubmit={onSubmit}> | ||
| <OrganizationCreationDefaultsAlert organizationCreationDefaults={props.organizationCreationDefaults} /> | ||
| <OrganizationProfileAvatarUploader |
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.
I'll make some changes to either add a initial blur while the image is loading, or render a spinner instead of the "remove" button
|
I'll try to come back to this one later today, just postponing a bit cause the higher priority is to support the team with remaining items to release another project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts:
- Around line 63-73: The __internal_toSnapshot method on
OrganizationCreationDefaults currently only serializes advisory and omits the
required form field; update OrganizationCreationDefaults.__internal_toSnapshot
to also include a serialized form property (mirror how advisory is serialized:
map the relevant fields from this.form into the expected
OrganizationCreationDefaultsJSONSnapshot structure) so the returned object
contains both advisory and form, and remove or avoid relying on the unsafe "as
unknown as" mask if possible so the return type properly matches
OrganizationCreationDefaultsJSONSnapshot.
📜 Review details
Configuration used: Repository YAML (base), Organization UI (inherited)
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 ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (8)
packages/clerk-js/src/core/resources/OrganizationCreationDefaults.tspackages/shared/src/types/organizationCreationDefaults.tspackages/ui/package.jsonpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/utils/blurhash.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/shared/src/types/organizationCreationDefaults.ts
🧰 Additional context used
📓 Path-based instructions (15)
**/*.{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/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
**/*.{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/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.tspackages/ui/package.json
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/ui/src/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
**/*.{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/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
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/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
**/*.ts?(x)
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
Files:
packages/ui/src/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
**/*.{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/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
**/*.{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/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
**/*.{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/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.tspackages/ui/package.json
**/*
⚙️ CodeRabbit configuration file
If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.
**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.
Files:
packages/ui/src/utils/blurhash.tspackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsxpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.tspackages/ui/package.json
**/*.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/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsx
**/*.{md,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Update documentation for API changes
Files:
packages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.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/elements/OrganizationAvatar.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/elements/Avatar.tsx
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 (2)
packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx (2)
packages/ui/src/elements/AvatarUploader.tsx (1)
AvatarUploaderProps(17-23)packages/shared/src/types/organization.ts (1)
OrganizationResource(38-69)
packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts (2)
packages/shared/src/types/organizationCreationDefaults.ts (4)
OrganizationCreationDefaultsResource(22-34)OrganizationCreationAdvisoryType(4-4)OrganizationCreationAdvisorySeverity(6-6)OrganizationCreationDefaultsJSON(8-20)packages/shared/src/types/snapshots.ts (1)
OrganizationCreationDefaultsJSONSnapshot(147-147)
⏰ 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). (25)
- GitHub Check: Integration Tests (machine, chrome, RQ)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (custom, chrome)
- GitHub Check: Integration Tests (billing, chrome, RQ)
- GitHub Check: Integration Tests (handshake, chrome)
- GitHub Check: Integration Tests (handshake:staging, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 16)
- GitHub Check: Integration Tests (nextjs, chrome, 16)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 15)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Integration Tests (tanstack-react-start, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Integration Tests (sessions:staging, chrome)
- GitHub Check: Integration Tests (express, chrome)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
packages/ui/package.json (1)
82-82: No action needed. The blurhash@2.0.5 dependency is valid and has no known security vulnerabilities.packages/ui/src/elements/OrganizationAvatar.tsx (1)
7-10: LGTM - blurHashPlaceholder prop correctly added and threaded.The new optional prop is properly typed, documented, and forwarded to the Avatar component.
Also applies to: 13-13, 19-19
packages/ui/src/elements/Avatar.tsx (1)
18-19: LGTM - blurhash placeholder loading logic is sound.The loading state, placeholder rendering, and fade-in transition are correctly implemented with proper state management and conditional rendering.
Also applies to: 36-36, 39-42, 53-62, 81-87
packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx (1)
11-15: LGTM - prop correctly threaded through uploader component.Also applies to: 17-17, 35-35
packages/ui/src/utils/blurhash.ts (1)
7-31: LGTM - blurhash decoder is well-guarded with comprehensive error handling.The function safely handles null inputs, errors during decoding, and potential SSR issues by returning undefined on any failure.
| public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot { | ||
| return { | ||
| advisory: this.advisory | ||
| ? { | ||
| code: this.advisory.code, | ||
| meta: this.advisory.meta, | ||
| severity: this.advisory.severity, | ||
| } | ||
| : null, | ||
| } as unknown as OrganizationCreationDefaultsJSONSnapshot; | ||
| } |
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.
Incomplete snapshot: missing form property.
The __internal_toSnapshot method only serializes advisory but omits form. Per OrganizationCreationDefaultsJSONSnapshot (alias for OrganizationCreationDefaultsJSON), both properties are required. The as unknown as cast at line 72 masks this type error. This will cause incomplete state restoration when snapshots are consumed.
🐛 Proposed fix
public __internal_toSnapshot(): OrganizationCreationDefaultsJSONSnapshot {
return {
advisory: this.advisory
? {
code: this.advisory.code,
meta: this.advisory.meta,
severity: this.advisory.severity,
}
: null,
- } as unknown as OrganizationCreationDefaultsJSONSnapshot;
+ form: {
+ name: this.form.name,
+ slug: this.form.slug,
+ logo: this.form.logo,
+ blur_hash: this.form.blurHash,
+ },
+ };
}🤖 Prompt for AI Agents
In @packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts around
lines 63 - 73, The __internal_toSnapshot method on OrganizationCreationDefaults
currently only serializes advisory and omits the required form field; update
OrganizationCreationDefaults.__internal_toSnapshot to also include a serialized
form property (mirror how advisory is serialized: map the relevant fields from
this.form into the expected OrganizationCreationDefaultsJSONSnapshot structure)
so the returned object contains both advisory and form, and remove or avoid
relying on the unsafe "as unknown as" mask if possible so the return type
properly matches OrganizationCreationDefaultsJSONSnapshot.
6b60da1 to
dbdb206
Compare
1cd23d7 to
9f3591b
Compare
9f3591b to
0532a91
Compare
| > | ||
| {ImgOrFallback} | ||
|
|
||
| {isLoading && ( |
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.
CleanShot.2026-01-07.at.17.55.29.mp4
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
🤖 Fix all issues with AI agents
In
@packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx:
- Around line 67-74: Wrap the default logo download logic in a try-catch and
guard HTTP errors: when defaultLogoUrl is used, fetch it and check response.ok
before calling response.blob(), then create the File and call
organization.setLogo({ file: logoFile }); on success; on any fetch/blob/File
error catch it, log the error (but do not rethrow) and allow organization
creation to continue without a logo. Ensure the code path that calls
organization.setLogo remains unchanged for the successful case and that failures
only result in a non-blocking log message.
In @packages/ui/src/elements/Avatar.tsx:
- Around line 63-73: handleImageLoad uses setTimeout to delay setLoaded(true)
which can fire after the component unmounts or imageUrl changes; store the timer
id in a ref (e.g., timeoutRef) instead of relying on useCallback cleanup, assign
the result of setTimeout to timeoutRef.current inside handleImageLoad, and add a
useEffect that watches imageUrl (and on mount/unmount) to
clearTimeout(timeoutRef.current) and reset timeoutRef.current to null so no
stale setLoaded runs after unmount or when imageUrl changes; keep
spinnerShownAtRef and SPINNER_MIN_DURATION_MS logic but ensure timeouts are
cleared before starting a new one.
📜 Review details
Configuration used: Repository YAML (base), Organization UI (inherited)
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 (20)
.changeset/calm-maps-work.mdpackages/clerk-js/src/core/resources/OrganizationCreationDefaults.tspackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/clerk-js/src/core/resources/User.tspackages/clerk-js/src/test/fixture-helpers.tspackages/localizations/src/en-US.tspackages/shared/src/types/index.tspackages/shared/src/types/localization.tspackages/shared/src/types/organizationCreationDefaults.tspackages/shared/src/types/organizationSettings.tspackages/shared/src/types/snapshots.tspackages/shared/src/types/user.tspackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsxpackages/ui/src/elements/Avatar.tsxpackages/ui/src/elements/AvatarUploader.tsxpackages/ui/src/elements/OrganizationAvatar.tsx
🚧 Files skipped from review as they are similar to previous changes (12)
- packages/ui/src/elements/AvatarUploader.tsx
- packages/shared/src/types/organizationSettings.ts
- packages/shared/src/types/snapshots.ts
- packages/shared/src/types/localization.ts
- packages/shared/src/types/organizationCreationDefaults.ts
- packages/clerk-js/src/core/resources/User.ts
- packages/shared/src/types/user.ts
- packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/tests/TaskChooseOrganization.test.tsx
- packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
- packages/localizations/src/en-US.ts
- packages/shared/src/types/index.ts
- .changeset/calm-maps-work.md
🧰 Additional context used
📓 Path-based instructions (13)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
All code must pass ESLint checks with the project's configuration
Files:
packages/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
packages/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
packages/**/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
packages/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Follow established naming conventions (PascalCase for components, camelCase for variables)
Files:
packages/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
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/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
**/*.ts?(x)
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use proper TypeScript error types
Files:
packages/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.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/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)
Use ESLint with custom configurations tailored for different package types
Files:
packages/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
**/*.{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/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
**/*
⚙️ CodeRabbit configuration file
If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.
**/*: Only comment on issues that would block merging, ignore minor or stylistic concerns.
Restrict feedback to errors, security risks, or functionality-breaking problems.
Do not post comments on code style, formatting, or non-critical improvements.
Keep reviews short: flag only issues that make the PR unsafe to merge.
Group similar issues into a single comment instead of posting multiple notes.
Skip repetition: if a pattern repeats, mention it once at a summary level only.
Do not add general suggestions, focus strictly on merge-blocking concerns.
If there are no critical problems, respond with minimal approval (e.g., 'Looks good'). Do not add additional review.
Avoid line-by-line commentary unless it highlights a critical bug or security hole.
Highlight only issues that could cause runtime errors, data loss, or severe maintainability issues.
Ignore minor optimization opportunities, focus solely on correctness and safety.
Provide a top-level summary of critical blockers rather than detailed per-line notes.
Comment only when the issue must be resolved before merge, otherwise remain silent.
When in doubt, err on the side of fewer comments, brevity and blocking issues only.
Avoid posting any refactoring issues.
Files:
packages/clerk-js/src/test/fixture-helpers.tspackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/clerk-js/src/core/resources/OrganizationSettings.tspackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.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/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
**/*.{md,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Update documentation for API changes
Files:
packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.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/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsxpackages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsxpackages/ui/src/elements/Avatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsxpackages/ui/src/elements/OrganizationAvatar.tsxpackages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
🧬 Code graph analysis (4)
packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx (2)
packages/ui/src/elements/AvatarUploader.tsx (1)
AvatarUploaderProps(17-23)packages/shared/src/types/organization.ts (1)
OrganizationResource(38-69)
packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx (3)
packages/shared/src/types/organizationCreationDefaults.ts (1)
OrganizationCreationDefaultsResource(22-34)packages/ui/src/elements/Alert.tsx (1)
Alert(13-65)packages/ui/src/primitives/Text.tsx (1)
Text(46-57)
packages/ui/src/elements/OrganizationAvatar.tsx (2)
packages/shared/src/types/organization.ts (1)
OrganizationResource(38-69)packages/ui/src/elements/Avatar.tsx (1)
Avatar(25-170)
packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx (2)
packages/react/src/isomorphicClerk.ts (1)
user(730-736)packages/shared/src/types/organizationCreationDefaults.ts (1)
OrganizationCreationDefaultsResource(22-34)
⏰ 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: Unit Tests (**)
- GitHub Check: Unit Tests (shared, clerk-js, RQ)
- GitHub Check: Publish with pkg-pr-new
- GitHub Check: Static analysis
- GitHub Check: Integration Tests (billing, chrome, RQ)
- GitHub Check: Integration Tests (machine, chrome, RQ)
- GitHub Check: Integration Tests (quickstart, chrome, 16)
- GitHub Check: Integration Tests (custom, chrome)
- GitHub Check: Integration Tests (quickstart, chrome, 15)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 16)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (handshake, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: Integration Tests (sessions:staging, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: Integration Tests (handshake:staging, chrome)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (tanstack-react-start, chrome)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Integration Tests (express, chrome)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx (1)
1-40: No blocking issues found.The component correctly handles null/undefined advisory data and unknown advisory codes. Type usage aligns with shared definitions.
packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx (1)
22-59: No blocking issues found.The conditional fetch logic and prop threading for organization creation defaults are implemented correctly. Loading states are properly aggregated.
| if (file) { | ||
| await organization.setLogo({ file }); | ||
| } else if (defaultLogoUrl) { | ||
| const response = await fetch(defaultLogoUrl); | ||
| const blob = await response.blob(); | ||
| const logoFile = new File([blob], 'logo', { type: blob.type }); | ||
| await organization.setLogo({ file: logoFile }); | ||
| } |
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.
Missing error handling for logo fetch could abort organization creation.
The fetch and blob conversion for defaultLogoUrl has no error handling. Network failures, HTTP errors (404, 403, CORS issues), or blob conversion failures will throw an unhandled exception, preventing organization creation entirely. This blocks merging.
Wrap the fetch/blob/File creation in a try-catch, verify response.ok before calling .blob(), and log errors without blocking organization creation if the logo fetch fails.
🤖 Prompt for AI Agents
In
@packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
around lines 67 - 74, Wrap the default logo download logic in a try-catch and
guard HTTP errors: when defaultLogoUrl is used, fetch it and check response.ok
before calling response.blob(), then create the File and call
organization.setLogo({ file: logoFile }); on success; on any fetch/blob/File
error catch it, log the error (but do not rethrow) and allow organization
creation to continue without a logo. Ensure the code path that calls
organization.setLogo remains unchanged for the successful case and that failures
only result in a non-blocking log message.
0532a91 to
3f86a35
Compare
Description
Resolves ORGS-1027, ORGS-1136
Introduce organization creation defaults to
TaskChooseOrganizationcomponent - this is based new "Require organization membership" options from the Clerk Dashboard, where C1s can define default organization naming rulesWe're also now detecting a default logo based on the user's email domain.
CleanShot.2025-12-19.at.12.32.42.mp4
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.