Skip to content

Commit a3977f4

Browse files
committed
Safely execute prompt guard within hooks
1 parent 6f21779 commit a3977f4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

packages/shared/src/organization.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ export function useAttemptToEnableOrganizations(caller: 'useOrganization' | 'use
3030

3131
useEffect(() => {
3232
// Guard to not run this effect twice on Clerk resource update
33-
if (hasAttempted.current) {
33+
if (hasAttempted.current || !clerk.loaded) {
3434
return;
3535
}
3636

3737
hasAttempted.current = true;
38-
clerk.__internal_attemptToEnableEnvironmentSetting({
38+
clerk.__internal_attemptToEnableEnvironmentSetting?.({
3939
for: 'organizations',
4040
caller,
4141
});

packages/vue/src/composables/useOrganization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export const useOrganization: UseOrganization = () => {
6060
clerk,
6161
value => {
6262
if (value?.loaded) {
63-
value.__internal_attemptToEnableEnvironmentSetting({
63+
value.__internal_attemptToEnableEnvironmentSetting?.({
6464
for: 'organizations',
6565
caller: 'useOrganization',
6666
});

0 commit comments

Comments
 (0)