Skip to content

feat(clerk-js): Backport exclusive-membership auto-activate for Core 2#8943

Merged
LauraBeatris merged 3 commits into
release/core-2from
nicolas/orgs-1643-core2-backport-exclusive-auto-activate
Jun 22, 2026
Merged

feat(clerk-js): Backport exclusive-membership auto-activate for Core 2#8943
LauraBeatris merged 3 commits into
release/core-2from
nicolas/orgs-1643-core2-backport-exclusive-auto-activate

Conversation

@NicolasLopes7

Copy link
Copy Markdown
Contributor

What

Backport of #8933 to the Core 2 (v5) line (release/core-2).

When the choose-organization session task fires for a member of an exclusive-membership organization, clerk-js now skips the org picker entirely: it shows the loading spinner and auto-calls setActive on that org (single-fire via useRef). On failure it surfaces the error and falls back to the normal choose/create flows. Non-exclusive members: zero change.

This brings the clerk-js half of exclusive-membership "after-auth" to customers still on the v5 / Core 2 line.

Changes

  • Expose Organization.exclusiveMembership — parse the FAPI exclusive_membership field (@clerk/shared types + clerk-js Organization resource fromJSON / __internal_toSnapshot). undefined for non-adopting instances.
  • TaskChooseOrganization — detect the membership whose organization.exclusiveMembership === true, render only the spinner and auto-setActive once, reusing the existing navigateOnSetActive / redirectUrlComplete wiring.

Core 2 adaptations (vs. the main/Core 3 original)

  • The UI lives in clerk-js/src/ui on Core 2 (not the separate @clerk/ui package).
  • SetActiveNavigate callback receives only { session } on Core 2 — decorateUrl was added in Core 3, so it's dropped from the navigate wiring.
  • exclusiveMembership is anchored next to maxAllowedMemberships / adminDeleteEnabled since selfServeSSOEnabled does not exist on Core 2.

Notes

  • Changeset bumps @clerk/clerk-js and @clerk/shared (minor). No @clerk/ui (Core 3 only).
  • Base is release/core-2 — do not retarget to main.

When the choose-organization session task fires for a member of an
exclusive-membership organization, clerk-js now skips the org picker and
auto-activates that organization (single-fire setActive, error fallback to
the normal flows). Exposes Organization.exclusiveMembership on the resource.

Backport of #8933 to the Core 2 (v5) line. Adapts to Core 2 APIs: the
SetActiveNavigate callback receives only { session } (no decorateUrl), and
exclusiveMembership is anchored next to maxAllowedMemberships since
selfServeSSOEnabled does not exist on Core 2.
@changeset-bot

changeset-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d28e3a3

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 Minor
@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

@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
clerk-js-sandbox Ready Ready Preview, Comment Jun 22, 2026 6:04pm
swingset Error Error Jun 22, 2026 6:04pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d9475906-b510-47d6-a916-061d4b074cba

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nicolas/orgs-1643-core2-backport-exclusive-auto-activate

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@8943

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@8943

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@8943

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@8943

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@8943

@clerk/types

npm i https://pkg.pr.new/@clerk/types@8943

@clerk/upgrade

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

@clerk/vue

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

commit: d28e3a3

Comment thread .changeset/exclusive-membership-auto-activate-core2.md Outdated
The exclusive-membership auto-activate backport tips clerk.js past the
931KB bundlewatch ceiling (931.01KB). Bump clerk.js to 934KB and
clerk.legacy.browser.js to 132KB to restore headroom.
@LauraBeatris LauraBeatris force-pushed the nicolas/orgs-1643-core2-backport-exclusive-auto-activate branch from b5b298d to d28e3a3 Compare June 22, 2026 18:03
@LauraBeatris LauraBeatris merged commit f478d90 into release/core-2 Jun 22, 2026
39 of 44 checks passed
@LauraBeatris LauraBeatris deleted the nicolas/orgs-1643-core2-backport-exclusive-auto-activate branch June 22, 2026 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants