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.
https://github.com/TanStack/query/blob/984bfa6f15271c0ba7c750d35daff2f6fb596667/packages/query-core/src/utils.ts#L89
Related Discussion
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
This pnpm hotpatch removing the isServer checks worked for me, for potential future pull requests