Skip to content

Commit 645f224

Browse files
authored
fix: isBrowser() to include check on window (#982)
There are several checks in `GoTrueClient.ts` that check `window?.[prop]` after checking `isBrowser()` which throws an error in node environments that have `document` defined but not `window`. Fixes: - supabase/supabase-js#786
1 parent 7242c55 commit 645f224

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lib/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ export function uuid() {
1414
})
1515
}
1616

17-
export const isBrowser = () => typeof document !== 'undefined'
17+
export const isBrowser = () =>
18+
typeof window !== 'undefined' && typeof document !== 'undefined'
1819

1920
const localStorageWriteTests = {
2021
tested: false,

0 commit comments

Comments
 (0)