Skip to content

Conversation

@LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Dec 17, 2025

Description

Resolves ORGS-1027, ORGS-1136

Introduce organization creation defaults to TaskChooseOrganization component - this is based new "Require organization membership" options from the Clerk Dashboard, where C1s can define default organization naming rules

We'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 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
    • Prefilled organization creation form (name, slug, logo) with optional default-logo auto-upload, in-form avatar controls, advisory warning when an organization already exists, loading spinner for logos, and a user-facing API to fetch creation defaults.
  • Documentation
    • Added localization string for existing-organization notification.
  • Tests
    • Added tests covering behavior when creation defaults are enabled or disabled.
  • Chores
    • Added related types and fixture helpers to support these features.

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

@vercel
Copy link

vercel bot commented Dec 17, 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 Jan 8, 2026 4:48pm

@LauraBeatris LauraBeatris changed the title feat(ui,clerk-js,shared): Add organization creation defaults to components feat(ui,clerk-js,shared): Surface organization creation defaults to components Dec 17, 2025
@changeset-bot
Copy link

changeset-bot bot commented Dec 17, 2025

🦋 Changeset detected

Latest commit: 5611bb5

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

This PR includes changesets to release 19 packages
Name Type
@clerk/localizations Minor
@clerk/clerk-js Minor
@clerk/shared Minor
@clerk/ui Minor
@clerk/react Patch
@clerk/chrome-extension Patch
@clerk/expo Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/tanstack-react-start Patch
@clerk/testing 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

@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 81ea1f2 to 12005fb Compare December 17, 2025 19:18
@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 21f7045 to 7093f4b Compare December 19, 2025 13:52
@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch 2 times, most recently from 5393111 to 97c7605 Compare December 19, 2025 14:25
@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 97c7605 to c5fcb39 Compare December 19, 2025 14:49
@LauraBeatris LauraBeatris requested a review from a team December 19, 2025 15:27
@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 13af5ff to 22edba6 Compare December 19, 2025 15:31
@LauraBeatris LauraBeatris marked this pull request as ready for review December 19, 2025 15:34
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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 317e59d and fbbfb30.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (8)
  • packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
  • packages/shared/src/types/organizationCreationDefaults.ts
  • packages/ui/package.json
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/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.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
  • 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/utils/blurhash.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/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.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/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.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/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.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/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
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/utils/blurhash.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/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.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/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.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
  • packages/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.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
  • packages/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.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/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.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/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.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/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 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 (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.

Comment on lines +63 to +73
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;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

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.

@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 6b60da1 to dbdb206 Compare January 7, 2026 14:31
@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 1cd23d7 to 9f3591b Compare January 7, 2026 20:57
@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 9f3591b to 0532a91 Compare January 7, 2026 20:58
>
{ImgOrFallback}

{isLoading && (
Copy link
Member Author

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

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between dbdb206 and 0532a91.

📒 Files selected for processing (20)
  • .changeset/calm-maps-work.md
  • packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/core/resources/User.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/localizations/src/en-US.ts
  • packages/shared/src/types/index.ts
  • packages/shared/src/types/localization.ts
  • packages/shared/src/types/organizationCreationDefaults.ts
  • packages/shared/src/types/organizationSettings.ts
  • packages/shared/src/types/snapshots.ts
  • packages/shared/src/types/user.ts
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/elements/AvatarUploader.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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
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/clerk-js/src/test/fixture-helpers.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.tsx
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/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.

@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 0532a91 to 3f86a35 Compare January 7, 2026 21:43
@LauraBeatris LauraBeatris force-pushed the laura/orgs-1136-update-taskchooseorganization-to-show-warning-when branch from 3f86a35 to 5611bb5 Compare January 8, 2026 16:47
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

🤖 Fix all issues with AI agents
In
@packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx:
- Around line 67-74: The defaultLogoUrl fetch in CreateOrganizationScreen blocks
form submission with no timeout; add an AbortController-based timeout around the
fetch(defaultLogoUrl) and handle abort errors so the submit flow won’t hang, and
introduce a loading state (e.g., setLogoUploading / logoUploading) toggled
before/after the fetch and organization.setLogo call so the UI can show
feedback; alternatively, move the logo upload off the critical path by creating
the organization first and then calling organization.setLogo({ file: logoFile })
in a fire-and-forget async task and gracefully handle failures (use symbols:
CreateOrganizationScreen, organization.setLogo, defaultLogoUrl).

In @packages/ui/src/elements/Avatar.tsx:
- Around line 63-73: The handleImageLoad event handler creates a setTimeout and
returns a cleanup function that never runs; replace that pattern by storing the
timer id in a ref (e.g., spinnerTimerRef) inside handleImageLoad, clear any
existing timer before assigning a new one, and expose a useEffect cleanup
(and/or clear timers when imageUrl changes and on unmount) that calls
clearTimeout(spinnerTimerRef.current) to avoid setLoaded running after unmount
or image change; update references in handleImageLoad, spinnerShownAtRef, and
any effect watching imageUrl to ensure timers are cleared correctly.
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 3f86a35 and 5611bb5.

📒 Files selected for processing (20)
  • .changeset/calm-maps-work.md
  • packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/core/resources/User.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/localizations/src/en-US.ts
  • packages/shared/src/types/index.ts
  • packages/shared/src/types/localization.ts
  • packages/shared/src/types/organizationCreationDefaults.ts
  • packages/shared/src/types/organizationSettings.ts
  • packages/shared/src/types/snapshots.ts
  • packages/shared/src/types/user.ts
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/__tests__/TaskChooseOrganization.test.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/ui/src/elements/Avatar.tsx
  • packages/ui/src/elements/AvatarUploader.tsx
  • packages/ui/src/elements/OrganizationAvatar.tsx
✅ Files skipped from review due to trivial changes (1)
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/tests/TaskChooseOrganization.test.tsx
🚧 Files skipped from review as they are similar to previous changes (14)
  • packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx
  • packages/shared/src/types/snapshots.ts
  • .changeset/calm-maps-work.md
  • packages/shared/src/types/organizationSettings.ts
  • packages/ui/src/elements/AvatarUploader.tsx
  • packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts
  • packages/clerk-js/src/core/resources/OrganizationSettings.ts
  • packages/clerk-js/src/test/fixture-helpers.ts
  • packages/localizations/src/en-US.ts
  • packages/shared/src/types/user.ts
  • packages/ui/src/elements/OrganizationAvatar.tsx
  • packages/shared/src/types/localization.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx
  • packages/shared/src/types/organizationCreationDefaults.ts
🧰 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/clerk-js/src/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.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/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.tsx
packages/**/src/**/*.{ts,tsx}

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

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.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/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.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/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.tsx
**/*.ts?(x)

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

Use proper TypeScript error types

Files:

  • packages/clerk-js/src/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.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/clerk-js/src/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.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/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.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/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.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/core/resources/User.ts
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/shared/src/types/index.ts
  • packages/ui/src/elements/Avatar.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.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/ui/src/elements/Avatar.tsx
**/*.{md,tsx}

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

Update documentation for API changes

Files:

  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/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/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
  • packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx
  • packages/ui/src/elements/Avatar.tsx
**/index.ts

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

Avoid barrel files (index.ts re-exports) as they can cause circular dependencies

Files:

  • packages/shared/src/types/index.ts
🧬 Code graph analysis (3)
packages/clerk-js/src/core/resources/User.ts (1)
packages/clerk-js/src/core/resources/OrganizationCreationDefaults.ts (1)
  • OrganizationCreationDefaults (11-74)
packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx (3)
packages/shared/src/types/organizationCreationDefaults.ts (1)
  • OrganizationCreationDefaultsResource (22-34)
packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/OrganizationCreationDefaultsAlert.tsx (1)
  • OrganizationCreationDefaultsAlert (6-25)
packages/ui/src/components/OrganizationProfile/OrganizationProfileAvatarUploader.tsx (1)
  • OrganizationProfileAvatarUploader (10-42)
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). (25)
  • GitHub Check: Integration Tests (quickstart, chrome, 16)
  • GitHub Check: Integration Tests (nextjs, chrome, 16)
  • GitHub Check: Integration Tests (quickstart, chrome, 15)
  • GitHub Check: Integration Tests (machine, chrome, RQ)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 16, RQ)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (billing, chrome, RQ)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (3)
packages/clerk-js/src/core/resources/User.ts (1)

56-56: LGTM - Public API addition is correct.

The new getOrganizationCreationDefaults method correctly delegates to the OrganizationCreationDefaults.retrieve() static method. The implementation is sound and follows the established pattern for similar methods in this class.

Note: JSDoc documentation for this public API method can be added as indicated in the PR objectives.

Also applies to: 279-280

packages/shared/src/types/index.ts (1)

16-16: LGTM - Type exports are correct.

The addition of the organizationCreationDefaults export and reordering of elementIds have no functional impact. Changes align with the new feature requirements.

Also applies to: 36-36

packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/index.tsx (1)

2-2: LGTM - Conditional fetching and data flow are correct.

The organization creation defaults are properly gated by the organizationCreationDefaults?.enabled setting and safely handle undefined user state. The data flow through the component hierarchy is clean and type-safe.

Also applies to: 5-6, 21-25, 57-60, 116-116, 126-126

Comment on lines +67 to +74
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 });
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add timeout and loading state for default logo fetch.

The fetch(defaultLogoUrl) call on the form submission critical path has no timeout, which could cause the form to hang indefinitely if the URL is slow or unresponsive. This degrades user experience significantly.

Recommended improvements

Add a timeout to the fetch operation and consider showing loading feedback:

-      } 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 });
-      }
+      } else if (defaultLogoUrl) {
+        const controller = new AbortController();
+        const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
+        try {
+          const response = await fetch(defaultLogoUrl, { signal: controller.signal });
+          const blob = await response.blob();
+          const logoFile = new File([blob], 'logo', { type: blob.type });
+          await organization.setLogo({ file: logoFile });
+        } catch (err) {
+          // Log but don't block org creation if logo fetch fails
+          console.warn('Failed to fetch default logo:', err);
+        } finally {
+          clearTimeout(timeoutId);
+        }
+      }

Alternatively, consider performing the logo upload asynchronously after organization creation completes to avoid blocking the user.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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 });
}
if (file) {
await organization.setLogo({ file });
} else if (defaultLogoUrl) {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
try {
const response = await fetch(defaultLogoUrl, { signal: controller.signal });
const blob = await response.blob();
const logoFile = new File([blob], 'logo', { type: blob.type });
await organization.setLogo({ file: logoFile });
} catch (err) {
// Log but don't block org creation if logo fetch fails
console.warn('Failed to fetch default logo:', err);
} finally {
clearTimeout(timeoutId);
}
}
🤖 Prompt for AI Agents
In
@packages/ui/src/components/SessionTasks/tasks/TaskChooseOrganization/CreateOrganizationScreen.tsx
around lines 67 - 74, The defaultLogoUrl fetch in CreateOrganizationScreen
blocks form submission with no timeout; add an AbortController-based timeout
around the fetch(defaultLogoUrl) and handle abort errors so the submit flow
won’t hang, and introduce a loading state (e.g., setLogoUploading /
logoUploading) toggled before/after the fetch and organization.setLogo call so
the UI can show feedback; alternatively, move the logo upload off the critical
path by creating the organization first and then calling organization.setLogo({
file: logoFile }) in a fire-and-forget async task and gracefully handle failures
(use symbols: CreateOrganizationScreen, organization.setLogo, defaultLogoUrl).

Comment on lines +63 to +73
const handleImageLoad = React.useCallback(() => {
if (spinnerShownAtRef.current) {
const elapsed = Date.now() - spinnerShownAtRef.current;
const remaining = SPINNER_MIN_DURATION_MS - elapsed;
if (remaining > 0) {
const timer = setTimeout(() => setLoaded(true), remaining);
return () => clearTimeout(timer);
}
}
setLoaded(true);
}, []);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Timer cleanup leak in event handler.

The return () => clearTimeout(timer) on line 69 is ineffective—event handlers don't support cleanup returns like useEffect does. If the component unmounts or imageUrl changes while this timer is pending, setLoaded(true) will still fire, causing a state update on an unmounted component.

Proposed fix: track timer in ref and clean up on imageUrl change
  const spinnerShownAtRef = React.useRef<number | null>(null);
+ const loadTimerRef = React.useRef<ReturnType<typeof setTimeout> | null>(null);

  React.useEffect(() => {
    setLoaded(false);
    setError(false);
    setSpinnerVisible(false);
    spinnerShownAtRef.current = null;
+   if (loadTimerRef.current) {
+     clearTimeout(loadTimerRef.current);
+     loadTimerRef.current = null;
+   }
  }, [imageUrl]);

  const handleImageLoad = React.useCallback(() => {
    if (spinnerShownAtRef.current) {
      const elapsed = Date.now() - spinnerShownAtRef.current;
      const remaining = SPINNER_MIN_DURATION_MS - elapsed;
      if (remaining > 0) {
-       const timer = setTimeout(() => setLoaded(true), remaining);
-       return () => clearTimeout(timer);
+       loadTimerRef.current = setTimeout(() => {
+         loadTimerRef.current = null;
+         setLoaded(true);
+       }, remaining);
+       return;
      }
    }
    setLoaded(true);
  }, []);

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In @packages/ui/src/elements/Avatar.tsx around lines 63 - 73, The
handleImageLoad event handler creates a setTimeout and returns a cleanup
function that never runs; replace that pattern by storing the timer id in a ref
(e.g., spinnerTimerRef) inside handleImageLoad, clear any existing timer before
assigning a new one, and expose a useEffect cleanup (and/or clear timers when
imageUrl changes and on unmount) that calls
clearTimeout(spinnerTimerRef.current) to avoid setLoaded running after unmount
or image change; update references in handleImageLoad, spinnerShownAtRef, and
any effect watching imageUrl to ensure timers are cleared correctly.

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.

2 participants