T
TanStack3y ago
fascinating-indigo

onlineManager (cannot detect going offline when I mock in DevTools)

onlineManager only logs { online: true }, no matter what happens and cannot detect going offline when I mock in DevTools. I'm using "@tanstack/react-query": "^4.29.7" version. I attached an image when I tried to mock the devtools into offline. What did I miss here? Thanks.
  const [isOnline, setIsOnline] = useState(onlineManager.isOnline())

  useEffect(
    () =>
      onlineManager.subscribe(() => {
        console.log('subscribe')
        setIsOnline(onlineManager.isOnline())
        console.log({ online: onlineManager.isOnline() })
      }),
    []
  )
  const [isOnline, setIsOnline] = useState(onlineManager.isOnline())

  useEffect(
    () =>
      onlineManager.subscribe(() => {
        console.log('subscribe')
        setIsOnline(onlineManager.isOnline())
        console.log({ online: onlineManager.isOnline() })
      }),
    []
  )
No description
6 Replies
fascinating-indigo
fascinating-indigo3y ago
That's a bug in the devtools I think. Have you tried with actually going offline?
fascinating-indigo
fascinating-indigoOP3y ago
Hello.. I tried going offline and yes it's perfectly working. :reactquery: Hello.. I tried going offline and yes it's perfectly working. :reactquery:
fascinating-indigo
fascinating-indigo3y ago
@Aryan i think i fixed this bug in the devtools somewhere in v5. Is it also fixed in the solid version?
fascinating-indigo
fascinating-indigo3y ago
GitHub
query/Devtools.tsx at b767179ea3d720dba9be1c62495aa07d453305fb · Ta...
🤖 Powerful asynchronous state management, server-state utilities and data fetching for the web. TS/JS, React Query, Solid Query, Svelte Query and Vue Query. - query/Devtools.tsx at b767179ea3d720db...
fascinating-indigo
fascinating-indigo3y ago
with window.dispatchEvent
fascinating-indigo
fascinating-indigoOP3y ago
I will check on this. Thank you so much. :reactquery: :reactquery:

Did you find this page helpful?