-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Description
Describe the bug
Issue
This isServer check prevents the queries from running in these environments, mistakenly seeing them as servers anywhere globalThis.window is undefined.
query/packages/query-core/src/utils.ts
Line 89 in 984bfa6
| export const isServer = typeof window === 'undefined' || 'Deno' in globalThis |
Workarounds
- Use queryClient.invalidateQueries in a
setInterval - [Maybe?] Put a "dummy" item into globalthis.window so that it isn't seen as a server. WARNING: This could have major unexpected side effects.
Proposed Fix
(by @TkDodo)
Decouple setInterval calls from isServer checks. None if this code runs on the server anyways, because subscriptions are only created on the client (they run in effects / useSyncExternalStore, so not on the server)
Your minimal, reproducible example
See above
Steps to reproduce
See above
Expected behavior
See above
How often does this bug happen?
Every time
Screenshots or Videos
No response
Platform
Chrome extensions and vscode extensions
Tanstack Query adapter
vanilla
TanStack Query version
v5.90.20
TypeScript version
v5.8.3
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels