Skip to content

feat(mosaic): restore the opener's options when the user profile modal reopens after a redirect - #10528

Closed
alexcarpenter wants to merge 17 commits into
fredrik/return-to-connected-accountsfrom
carp/mosaic-modal-return-options
Closed

alexcarpenter wants to merge 17 commits into
fredrik/return-to-connected-accountsfrom
carp/mosaic-modal-return-options

Conversation

@alexcarpenter

@alexcarpenter alexcarpenter commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Description

Stacked on #10523.

When the Mosaic UserProfile modal reopens after an OAuth or SSO redirect, it now gets back the options its opener passed: customPages, pageOrder, additionalOAuthScopes, apiKeysProps, mode and organizationProfileProps.

  • Opener registration. useModalOpener(surface, opener, options) registers the opener's current options with the modal host. A reopen with no explicit options uses them, and explicit options still win. UserButton and OrganizationSwitcher both register for the user profile, each under its own key, so neither overwrites the other's options.
  • Opener in the return URL. In modal mode, the return URL carries __clerk_mosaic_opener=user-button|organization-switcher next to __clerk_mosaic_modal. On return both params are stripped and the profile reopens for that opener. If the opener is missing, the last registered opener is used.
  • All profile redirects carry the return. The email SSO verification and enterprise account redirects now use the same return URL as connected accounts. The old __clerk_modal_state param is no longer written.

Missing pieces

  • UserProfile hardcodes mode='mounted' until feat(mosaic): export UserProfile and OrganizationProfile #10514 fixes it, so the return params are not written from inside the real modal yet.
  • Open questions: should the portal container be kept per opener, and do customers with their own button need a public API to register as an opener?

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:

alexcarpenter and others added 17 commits October 28, 2026 18:13
Skip account custom pages under the organization/ prefix in UserProfile, and keep only the first custom page per path in both profiles, warning about the rest.
When the active organization changes and the open page is no longer listed, the profile now stores the page it shows instead of keeping the old one, so switching back no longer reopens it. Applies to OrganizationProfile and the combined UserProfile.
… OAuth redirect

Connect and Reconnect from the Mosaic user profile modal now carry
__clerk_mosaic_modal=user-profile/account through the OAuth round trip.
MosaicProvider strips the param on mount and reopens the profile on the
Account page. Mosaic no longer writes the legacy __clerk_modal_state param,
which the clerk-js UI would act on.
@vercel

vercel Bot commented Oct 29, 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 Oct 29, 2026 1:45pm UTC
swingset Ready Ready Preview Oct 29, 2026 1:45pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Oct 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2a0d34f

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

@coderabbitai

coderabbitai Bot commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

This branch was successfully deployed

2 active deployments
Preview – swingset — 2a0d34f8 Deployed Oct 29, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 2a0d34f8 Deployed Oct 29, 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.

3 participants