-
Notifications
You must be signed in to change notification settings - Fork 279
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
chore(backend): Organization takes precedence over personal account in organization sync options #4320
Conversation
🦋 Changeset detectedLatest commit: 93deeba The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
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 |
organizationPatterns
takes precedence over personalAccountPatterns
in organization sync options
@izaaklauer I think this is more like a bug fix than an chore, cause if there was a case like the following:
then it wouldn't apply the organization patterns even if the route was matching correctly. |
organizationPatterns
takes precedence over personalAccountPatterns
in organization sync options
.changeset/stale-pans-clean.md
Outdated
@@ -0,0 +1,5 @@ | |||
--- | |||
"@clerk/backend": patch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd do minor as the change is significant but necessary.
@LauraBeatris You're right that those settings today will always activate the personal workspace, but today's jsdoc comments also specify that the personal workspace takes prescience, so it's not a bug! This change only switches which pattern matcher is applied first. It used to be personal workspace, but now it's organization, because organization is more likely to be prefixed. |
Good feedback @panteliselef! #4320 (comment)
Good feedback @panteliselef! #4320 (comment)
646acba
to
93deeba
Compare
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 activeWill 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 activeThis 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:
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.Type of change