Skip to content

Commit 684f3bd

Browse files
authored
fix(clerk-js): Do not allow setActive({ organization: null }) when organization selection is forced (#6073)
1 parent 685ddae commit 684f3bd

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

.changeset/petite-ravens-see.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/clerk-js': patch
3+
---
4+
5+
Do not allow `setActive({ organization: null })` when organization selection is forced

packages/clerk-js/bundlewatch.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{ "path": "./dist/clerk.js", "maxSize": "605kB" },
44
{ "path": "./dist/clerk.browser.js", "maxSize": "69.2KB" },
55
{ "path": "./dist/clerk.legacy.browser.js", "maxSize": "113KB" },
6-
{ "path": "./dist/clerk.headless*.js", "maxSize": "52.2KB" },
6+
{ "path": "./dist/clerk.headless*.js", "maxSize": "53KB" },
77
{ "path": "./dist/ui-common*.js", "maxSize": "106.3KB" },
88
{ "path": "./dist/vendors*.js", "maxSize": "40.2KB" },
99
{ "path": "./dist/coinbase*.js", "maxSize": "38KB" },

packages/clerk-js/src/core/clerk.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,6 +1071,10 @@ export class Clerk implements ClerkInterface {
10711071
);
10721072
}
10731073

1074+
if (organization === null && this.environment?.organizationSettings?.forceOrganizationSelection) {
1075+
throw new Error('setActive requires an organization parameter when organization selection is forced.');
1076+
}
1077+
10741078
const onBeforeSetActive: SetActiveHook =
10751079
typeof window !== 'undefined' && typeof window.__unstable__onBeforeSetActive === 'function'
10761080
? window.__unstable__onBeforeSetActive

0 commit comments

Comments
 (0)