Skip to content

Commit c95cebc

Browse files
committed
fix(devtools): guard against window for server envs
1 parent 8a8e318 commit c95cebc

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/devtools/devtools.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,13 @@ export function ReactQueryDevtools({
153153

154154
run()
155155

156-
window.addEventListener('resize', run)
156+
if (typeof window !== 'undefined') {
157+
window.addEventListener('resize', run)
157158

158-
return () => {
159-
window.removeEventListener('resize', run)
160-
rootRef.current.parentElement.style.paddingBottom = previousValue
159+
return () => {
160+
window.removeEventListener('resize', run)
161+
rootRef.current.parentElement.style.paddingBottom = previousValue
162+
}
161163
}
162164
}
163165
}, [isResolvedOpen])

0 commit comments

Comments
 (0)