Skip to content
Source
Sign inSign up
TanStack/query

minimizing devtools loses offline toggle state #7094

Send to my agent
ClosedTkDodo opened this issue 2 comments
TkDodocommented

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:

  1. re-set the state of the onlineManager when the devtools unmount
  2. 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

  1. TkDodo added labelsbug

  2. TkDodo added labelspackage: query-devtools

  3. @ardeora could you have a look here?

  4. Yeah I think what's going wrong here. I'll fix it today!

Sign in to join this conversation.