Skip to content

Conversation

@LauraBeatris
Copy link
Member

@LauraBeatris LauraBeatris commented Mar 18, 2025

Description

Resolves ORGS-537

Introduces force_organization_selection on environment settings. When enabled, all organization components should hide the "personal workspace" options.

This is also important for the after-auth flow with force_organization_selection, to avoid displaying the option to select a personal account on OrganizationList, and to also not display "Personal Workspace" on OrganizationSwitcher

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:

@LauraBeatris LauraBeatris self-assigned this Mar 18, 2025
@vercel
Copy link

vercel bot commented Mar 18, 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 Mar 18, 2025 8:46pm

@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2025

🦋 Changeset detected

Latest commit: 21a931c

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

This PR includes changesets to release 22 packages
Name Type
@clerk/clerk-js Patch
@clerk/types Patch
@clerk/chrome-extension Patch
@clerk/clerk-expo Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/shared Patch
@clerk/tanstack-start Patch
@clerk/testing Patch
@clerk/themes 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 changed the title chore(clerk-js,types): Enforce organization selection via environment settings chore(clerk-js,types): Hide personal workspace options when organization selection is enforced Mar 18, 2025
@LauraBeatris LauraBeatris requested a review from a team March 18, 2025 15:27
@LauraBeatris LauraBeatris force-pushed the laura/enforce-organization-selection-environment branch from 1bd1e9d to 8543336 Compare March 18, 2025 15:27
@LauraBeatris LauraBeatris marked this pull request as ready for review March 18, 2025 15:36
skipInvitationScreen: ctx.skipInvitationScreen || false,
hideSlug: ctx.hideSlug || false,
hidePersonal: ctx.hidePersonal || false,
hidePersonal: organizationSettings.forceOrganizationSelection || ctx.hidePersonal || false,
Copy link
Member

Choose a reason for hiding this comment

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

Should we deprecate this prop once the feature releases?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think there could still be cases for developers to pass hidePersonal even without having force_organization_selection configured on the instance

I'd like to make this change later based on some data if possible, if we could push telemetry data for organization components usage with hidePersonal and also send force_organization_selection value along

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense! Let's add it to the project as a discussion topic so we don't forget. I agree that there might be cases where someone could take advantage of it, but if we have the opportunity to remove options in favor of our recommended approach that would be good 👍

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the prop always have priority over the env var ?

Copy link
Member Author

@LauraBeatris LauraBeatris Mar 18, 2025

Choose a reason for hiding this comment

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

Let's say the developer currently uses hidePersonal=false on the application, and then enables force an org in the Clerk Dashboard.

The expected behavior is to hide personal workspace across all org components. Especially for the after-auth flow, because if it gets displayed, then it'd lead to a bug or the user could select a personal workspace and get stuck with a pending session.

skipInvitationScreen: ctx.skipInvitationScreen || false,
hideSlug: ctx.hideSlug || false,
hidePersonal: ctx.hidePersonal || false,
hidePersonal: organizationSettings.forceOrganizationSelection || ctx.hidePersonal || false,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the prop always have priority over the env var ?

@LauraBeatris LauraBeatris force-pushed the laura/enforce-organization-selection-environment branch from f33cc01 to 21a931c Compare March 18, 2025 20:42
@LauraBeatris LauraBeatris force-pushed the laura/enforce-organization-selection-environment branch from 21a931c to 310307d Compare March 18, 2025 20:44
@LauraBeatris LauraBeatris merged commit 39bbc51 into main Mar 19, 2025
30 checks passed
@LauraBeatris LauraBeatris deleted the laura/enforce-organization-selection-environment branch March 19, 2025 14:08
wobsoriano pushed a commit that referenced this pull request Mar 20, 2025
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.

5 participants