Skip to content

Commit a457939

Browse files
committed
Use inBrowser utility for environment check
Replaces direct document type check with the inBrowser utility to determine browser environment in Protect class initialization.
1 parent aee6e57 commit a457939

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import type { Environment } from './resources';
1+
import { inBrowser } from '@clerk/shared/browser';
22

3+
import type { Environment } from './resources';
34
export class Protect {
45
#initialized: boolean = false;
56

@@ -12,7 +13,7 @@ export class Protect {
1213
} else if (this.#initialized) {
1314
// already initialized - do nothing
1415
return;
15-
} else if (typeof document === 'undefined') {
16+
} else if (!inBrowser()) {
1617
// no document: not running browser?
1718
return;
1819
}

0 commit comments

Comments
 (0)