Skip to content

fix(clerk-js): Do not display organization list after creating organization throw tasks flow #6117

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

Conversation

LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Jun 13, 2025

Resolves ORGS-683, ORGS-705

Issue

Currently, when creating an organization during the force-an-org step, it re-renders OrganizationList to display the list of memberships. This display is shown for a couple of seconds until the navigation to redirectUrlComplete is complete.

Solution

This PR introduces a separate chunk of UI for the force-an-org step, in which gets rendered only if it's inside a SessionTasks flow. With that, it can run a different logic to not display the list of memberships after creation, but only if there are no organization memberships attached to the session.

CleanShot.2025-06-18.at.11.36.50.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

    • Introduced a new flow for organization selection, allowing users to select or create an organization with improved loading states and error handling.
    • Added a dedicated component to manage the forced organization selection process.
  • Bug Fixes

    • Prevented the organization list from displaying immediately after creating an organization during forced organization selection.
  • Improvements

    • Enhanced navigation and state management during session tasks, providing clearer feedback and preventing redundant redirects.
    • Updated UI components for more flexible organization creation and selection flows.
    • Improved session navigation hooks to better synchronize client and server authentication states.
  • Chores

    • Increased JavaScript bundle size limits to accommodate recent updates.

@LauraBeatris LauraBeatris self-assigned this Jun 13, 2025
Copy link

changeset-bot bot commented Jun 13, 2025

🦋 Changeset detected

Latest commit: e01d4f5

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

This PR includes changesets to release 3 packages
Name Type
@clerk/clerk-js Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Jun 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
clerk-js-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 20, 2025 5:07pm

Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

📝 Walkthrough

"""

Walkthrough

This change refactors the organization selection and creation flow within the @clerk/clerk-js package, particularly targeting the force organization selection scenario. It introduces a new ForceOrganizationSelectionTask component to control the UI flow, ensuring the organization list is not briefly shown after creating an organization. The flow now conditionally renders either the organization list or the creation form based on user state. Context and navigation logic are updated, and defensive checks are added to prevent exceptions during session tasks. Bundle size limits are also slightly increased in the configuration.

Assessment against linked issues

Objective Addressed Explanation
Prevent exception after creating a first organization on after-auth (ORGS-683)
Ensure SDK navigates to afterCreateOrganizationUrl after org creation (ORGS-683)
Prevent organization list from displaying after org creation in force-org-selection flow (ORGS-705)
Remove brief display of organization list after org creation in force-org-selection (ORGS-705)

Suggested reviewers

  • NicolasLopes7
    """

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb33aef and e01d4f5.

📒 Files selected for processing (3)
  • packages/clerk-js/bundlewatch.config.json (2 hunks)
  • packages/clerk-js/src/core/clerk.ts (2 hunks)
  • packages/testing/src/playwright/unstable/page-objects/sessionTask.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • packages/testing/src/playwright/unstable/page-objects/sessionTask.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/clerk-js/bundlewatch.config.json
  • packages/clerk-js/src/core/clerk.ts
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@LauraBeatris LauraBeatris changed the title fix(clerk-s): Do not display organization list after creating organization throw tasks flow fix(clerk-js): Do not display organization list after creating organization throw tasks flow Jun 13, 2025
@LauraBeatris LauraBeatris changed the title fix(clerk-js): Do not display organization list after creating organization throw tasks flow [wip] fix(clerk-js): Do not display organization list after creating organization throw tasks flow Jun 13, 2025
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch 2 times, most recently from 42c4bce to 7904177 Compare June 13, 2025 19:17
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from 7904177 to f1f5250 Compare June 13, 2025 19:23
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from f1f5250 to c96f964 Compare June 13, 2025 19:24
@LauraBeatris LauraBeatris changed the title [wip] fix(clerk-js): Do not display organization list after creating organization throw tasks flow fix(clerk-js): Do not display organization list after creating organization throw tasks flow Jun 13, 2025
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from ff68c71 to 69324a6 Compare June 13, 2025 19:32
@LauraBeatris LauraBeatris changed the title fix(clerk-js): Do not display organization list after creating organization throw tasks flow fix(clerk-js): Do not display organization list after creating organization throw tasks flow Jun 13, 2025
@LauraBeatris LauraBeatris marked this pull request as ready for review June 13, 2025 19:36
@LauraBeatris LauraBeatris requested review from aeliox, wobsoriano and a team as code owners June 13, 2025 19:36
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
packages/clerk-js/src/ui/components/OrganizationList/OrganizationListPage.tsx (1)

273-289: Add accessible status to the loading spinner

Screen-reader users receive no feedback during the blocking loading state.
Wrap the spinner in a role="status" container or pass aria-label:

-    <Spinner
-      size={'lg'}
-      colorScheme={'primary'}
-      elementDescriptor={descriptors.spinner}
-    />
+    <Spinner
+      size={'lg'}
+      colorScheme={'primary'}
+      elementDescriptor={descriptors.spinner}
+      role='status'
+      aria-label='Loading'
+    />

This is a lightweight fix with zero visual impact.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 69f8cff and 69324a6.

📒 Files selected for processing (2)
  • .changeset/common-mice-ring.md (1 hunks)
  • packages/clerk-js/src/ui/components/OrganizationList/OrganizationListPage.tsx (3 hunks)
🔇 Additional comments (1)
.changeset/common-mice-ring.md (1)

5-5: Changelog entry looks good

No issues; entry is concise and clear.

@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from 69324a6 to d6269e6 Compare June 13, 2025 19:41
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from c79f9fb to e4089cb Compare June 20, 2025 12:46
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from e4089cb to acf4b69 Compare June 20, 2025 15:06
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch 2 times, most recently from 5fa7d86 to d0d4128 Compare June 20, 2025 16:19
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from d0d4128 to c646c72 Compare June 20, 2025 16:43
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from c646c72 to eb33aef Compare June 20, 2025 16:57
@LauraBeatris LauraBeatris force-pushed the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch from eb33aef to e01d4f5 Compare June 20, 2025 17:06
@LauraBeatris LauraBeatris merged commit 547f49d into main Jun 20, 2025
39 checks passed
@LauraBeatris LauraBeatris deleted the laura/orgs-683-when-creating-a-first-organization-on-after-auth-clerkreact branch June 20, 2025 17:19
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.

4 participants