Describe the bug#
When clicking the offline toggle, it correctly goes into "offline" mode. However, minimizing + maximizing it shows the toggle in "online" mode, while in fact, the onlineManager is still offline.
Your minimal, reproducible example#
https://tanstack.com/query/v5/docs/framework/react/examples/basic
Steps to reproduce#
- open the devtools in the basic example
- click the offline toggle
- navigate around, you'll see some paused queries
- minimize the offline toggle
- navigate some more, everything is still offline
- open the devtools again
--> the toggle now says we're online, but we're not.
Expected behavior#
I think minimizing the devtools unmounts them, so the internal state is lost. I see two possible solutions:
- re-set the state of the onlineManager when the devtools unmount
- keep the state of the offline toggle while the devtools are unmounted (e.g. by lifting the state up to the component that is mounted - the tanstack logo container component). I wouldn't put it in localstorage because that would persist it over page reloads, which is unexpected.
How often does this bug happen?#
None
Screenshots or Videos#
No response
Platform#
all
Tanstack Query adapter#
None
TanStack Query version#
v5
TypeScript version#
No response
Additional context#
No response
@ardeora could you have a look here?