Skip to content
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

chore(backend): Organization takes precedence over personal account in organization sync options. #4320

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

izaaklauer
Copy link
Contributor

@izaaklauer izaaklauer commented Oct 11, 2024

What changed?

This change makes organization URL patterns take precedence over personal account patterns in the new OrganizationSync handshake options.

Why now?

Initially, we didn't have a strong argument for which option should have precedence. Now, a use-case has become clear! If a fixed prefix is going to be present in a URL, we think it's more likely that it will be in org-indicating URLs and not personal-account-indicating URLs.

E.g. the following pattern:
/orgs/myorg/settings <- Fixed prefix "orgs" implies "mygreatorg" is active
/settings <- Absence of prefix implies that the personal account is active

Will occur more often than:
/me/settings <- Fixed prefix "me" indicates that the personal account is active
/mygreatorg/settings <- Absence of fixed prefix implies an organization is active

This is relevant because it's easiest to have the activatible entity type (org or personal account) with a fixed prefix take presedence, so that the other can wildcard match all routes.

For example, for an app using the first pattern, they could use the following middleware options:

{
  personalAccountPatterns: [
    '/', 
    '/(.*)'
  ],
  organizationPatterns: [
    '/orgs/:slug', 
    '/orgs/:slug/(.*)'
  ]
}

E.g. letting the personal account match everything that does not have the org prefix.

Is this a breaking change?

Technically yes, but this feature was introduced early this week, and has not yet been documented or formally announced, so I don't expect it to be in use yet, much less for anyone to be depending on this nuance yet.

Checklist

  • npm test runs as expected.
  • npm run 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:

Copy link

changeset-bot bot commented Oct 11, 2024

🦋 Changeset detected

Latest commit: 2d85de3

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

This PR includes changesets to release 9 packages
Name Type
@clerk/backend Patch
@clerk/astro Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
@clerk/tanstack-start Patch
@clerk/testing 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

@izaaklauer izaaklauer changed the title Izaak/orgs 132 org precidence over personal account chore(backend): organization takes precedence over personal account in organization sync options Oct 11, 2024
@izaaklauer izaaklauer changed the title chore(backend): organization takes precedence over personal account in organization sync options chore(backend): Organization takes precedence over personal account in organization sync options. Oct 11, 2024
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