Skip to content

Commit da3442f

Browse files
Revert "fix(sdk): safe access localstorage in browser detection"
This reverts commit 582f168.
1 parent 582f168 commit da3442f

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

.changeset/tall-balloons-clean.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/sdk/src/logger.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,15 @@ function safeToString(info: any): string {
1010
}
1111

1212
const DEBUG_LOG = '[ FEDERATION DEBUG ]';
13-
14-
function safeGetLocalStorageItem() {
15-
try {
16-
if (typeof window !== 'undefined' && window.localStorage) {
17-
return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
18-
}
19-
} catch (error) {
20-
return typeof typeof document !== 'undefined';
21-
}
22-
return false;
23-
}
2413
class Logger {
2514
enable = false;
2615
identifier: string;
2716
constructor(identifier?: string) {
2817
this.identifier = identifier || DEBUG_LOG;
29-
if (isBrowserEnv() && safeGetLocalStorageItem()) {
18+
if (
19+
isBrowserEnv() &&
20+
localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE
21+
) {
3022
this.enable = true;
3123
} else if (isDebugMode()) {
3224
this.enable = true;

0 commit comments

Comments
 (0)