Skip to content

refactor(mosaic): let another card hold the organization task as one step - #10985

Merged
austincalvelage merged 7 commits into
mainfrom
austin/mosaic-embedded-org-task
Dec 3, 2026
Merged

austincalvelage merged 7 commits into
mainfrom
austin/mosaic-embedded-org-task

Conversation

@austincalvelage

@austincalvelage austincalvelage commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

Description

Lets another card hold the organization task as one step. Sign-up uses this in #10881. It's split out so the sign-up PR stays about sign-up.

The task stays a feature, with its own model, controller and copy. It's not a block. <TaskChooseOrganization /> is unchanged.

  • useTaskChooseOrganizationFlow(options) runs the task's model and controller and returns one controller.
  • TaskChooseOrganizationContent({ controller }) renders the task without its card and handles its own states: the steps, a card-less skeleton while organizations load, and sending the user on once the task is complete.
  • isTaskChooseOrganizationReady(controller) says when the task's data has loaded, so the parent can keep its current screen until then.
  • <TaskChooseOrganization /> is Card.Root around the same content. A new index.ts exports these.
  • enabled on the organization task, organization-list and create-organization models lets the task skip its fetches until the parent reaches it. It is not a public CreateOrganization prop.
  • views.md: "One flow per surface" becomes "One flow per feature". A feature's view renders one Flow.Root, and a feature mounted as a step of another keeps its own, as Reverification already does in the add-email dialog. This renames an existing rule to match the code.
  • views.md, "Who renders Card.Root": names the use<Feature>Flow hook and the content without the card that a mounted feature exports.

Nothing calls the new exports until #10881.

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:

@changeset-bot

changeset-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e5689a3

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

This PR includes changesets to release 0 packages

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

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

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

@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Dec 3, 2026 8:32am UTC
mosaic-docs Ready Ready Preview Dec 3, 2026 8:32am UTC
swingset Ready Ready Preview Dec 3, 2026 8:32am UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

Organization creation and list hooks now accept optional enabled settings, which the task model forwards to its dependent hooks. The task exposes a flow controller and separates step content from card wrappers. Its content renders loading, ready, or continuation states. Documentation describes the flow and embedding interfaces.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested reviewers: maxyinger

Merge Risk: Minimal · previous review 10dbf

This refactor lets another card host the organization task as one step, and TaskChooseOrganization keeps its card wrapper. No user-facing behavior change was identified, and nothing in the current code uses the new exports. Merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the organization task's content is separated from its card so another card can host it as one step. It matches the changeset, which adds useTaskChooseOrganizationFlow,…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description states the PR lets another card hold the organization task as one step, and it names the new exports (useTaskChooseOrganizationFlow, TaskChooseOrganizationContent, isTaskChooseOrganiza…
Full details: Title check

Explanation

The title names the main change: the organization task's content is separated from its card so another card can host it as one step. It matches the changeset, which adds useTaskChooseOrganizationFlow, a card-less TaskChooseOrganizationContent, and enabled options. The title is a single, concise sentence with a conventional refactor prefix, so it passes.

Full details: Description check

Explanation

The description states the PR lets another card hold the organization task as one step, and it names the new exports (useTaskChooseOrganizationFlow, TaskChooseOrganizationContent, isTaskChooseOrganizationReady), the enabled flags on the models, and the views.md rule change. It is specific and matches the changeset, so it is not off-topic or vague.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: This review skipped 6 repositories. Cross-repository analysis may be incomplete. Check linked repository access and settings.

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between bba3b27 and 10dbf65.

Files selected for processing: 1

  • packages/mosaic/docs/views.md
Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

Included review availability: This review used your included allowance. 4 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

@blacksmith-sh

blacksmith-sh Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Matches Organization task renders inside another card

The parent card showed the task heading, Acme and Globex rows, the create button and sign-out, with one card root (the parent's).

Task inside parent card

Probe output

Also checked · 5 match

Matches Disabled task skips its organization fetches
Matches Ready check waits for organization data
Matches Standalone task still renders in its card
Matches Embedded content sends the user on when the task is done
Matches Creating an organization in a host card sends the user on

Proof on 3474bed2 (from 2cb5467e) · mocked: fake-fapi (Mosaic's feature-test fake FAPI (MSW) serves a pending session with organization...) · Did Proof get it right? Yes · No

View full Proof report · React 👎 or comment @codesmith dismiss this proof to dismiss

@pkg-pr-new

pkg-pr-new Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/electron

npm i https://pkg.pr.new/@clerk/electron@10985

@clerk/electron-passkeys

npm i https://pkg.pr.new/@clerk/electron-passkeys@10985

@clerk/eslint-plugin

npm i https://pkg.pr.new/@clerk/eslint-plugin@10985

@clerk/expo

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

@clerk/expo-biometrics

npm i https://pkg.pr.new/@clerk/expo-biometrics@10985

@clerk/expo-google-signin

npm i https://pkg.pr.new/@clerk/expo-google-signin@10985

@clerk/expo-native-components

npm i https://pkg.pr.new/@clerk/expo-native-components@10985

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/hono

npm i https://pkg.pr.new/@clerk/hono@10985

@clerk/localizations

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

@clerk/mosaic

npm i https://pkg.pr.new/@clerk/mosaic@10985

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/react

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

@clerk/react-router

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/ui

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

@clerk/upgrade

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

@clerk/vue

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

commit: e5689a3

@austincalvelage
austincalvelage force-pushed the austin/mosaic-embedded-org-task branch from 6712519 to 88af684 Compare November 24, 2026 23:24
@austincalvelage
austincalvelage force-pushed the austin/mosaic-embedded-org-task branch from 239a5e4 to 10dbf65 Compare November 24, 2026 23:52
@austincalvelage
austincalvelage force-pushed the austin/mosaic-embedded-org-task branch from 10dbf65 to 78e836c Compare November 25, 2026 00:02
Base automatically changed from austin/mosaic-auth-alternative-channel-submit to main November 25, 2026 02:33
@austincalvelage
austincalvelage force-pushed the austin/mosaic-embedded-org-task branch from 78e836c to 6f584af Compare November 25, 2026 02:33
A whole feature embedded as one step keeps its own Flow.Root, so another
card can hold the organization task as one step. views.md records the
exception.
…is embedded

useTaskChooseOrganizationFlow runs the task's model and controller and returns
one controller. TaskChooseOrganizationContent takes it and renders the steps
without the card, or sends the user on once the task is complete, like
Reverification. TaskChooseOrganization uses the same hook. enabled stays off
the public CreateOrganization props.
Who renders Card.Root already says a feature another feature embeds exports its
steps. It now names the use<Feature>Flow hook and the two shapes it returns, and
One flow per surface points there for steps that keep their own Flow.Root.
… its own

Reverification already brings its own Flow.Root into the add-email dialog and
ConfirmShell, so one card can hold nested flows. The rule now names what it
limits, a feature's own view, and says the exported skeleton is not a surface.
…bedded task

The host card dropped the task as soon as the session had none left, which
stopped the form before its onComplete ran, so nothing navigated. The create
model now takes a navigate callback and passes it to setActive, so the redirect
runs inside the activation and no longer depends on the task staying mounted.
@austincalvelage
austincalvelage force-pushed the austin/mosaic-embedded-org-task branch from 3474bed to e5689a3 Compare December 3, 2026 08:27
@austincalvelage
austincalvelage merged commit d9882a6 into main Dec 3, 2026
61 checks passed
@austincalvelage
austincalvelage deleted the austin/mosaic-embedded-org-task branch December 3, 2026 08:34

This branch was successfully deployed

2 active deployments
Preview – swingset — e5689a3d Deployed Dec 3, 2026 by vercel[bot]
Preview – clerk-js-sandbox — e5689a3d Deployed Dec 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants