We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
ReferenceError: window is not defined
1 parent 6619f76 commit 96dcbdfCopy full SHA for 96dcbdf
.changeset/lazy-terms-hang.md
@@ -0,0 +1,5 @@
1
+---
2
+'@graphiql/react': patch
3
4
+
5
+fix: `ReferenceError: window is not defined` when using with SSR
packages/graphiql-react/src/utility/debounce.ts
@@ -8,12 +8,12 @@ export function debounce<F extends (...args: any[]) => any>(
8
duration: number,
9
fn: F,
10
) {
11
- let timeout: number | null;
+ let timeout: ReturnType<typeof setTimeout> | null;
12
return function (...args) {
13
if (timeout) {
14
- window.clearTimeout(timeout);
+ clearTimeout(timeout);
15
}
16
- timeout = window.setTimeout(() => {
+ timeout = setTimeout(() => {
17
timeout = null;
18
fn(...args);
19
}, duration);
0 commit comments