Skip to content
Source
Sign inSign up
TanStack/query

ReactQueryDevtoolsPanel component gets stuck in the "fetching" state #2745

Send to my agent
Closedalexanderson1993(GitHub profile, opens in a new tab) opened this issue 4 comments

Describe the bug For some reason, the ReactQueryDevtools component correctly shows the cache state, while the ReactQueryDevtoolsPanel component remains stuck in the 'fetching' state. The reproduction shows both dev tools running at the same time, but the same behavior happens when only ReactQueryDevtoolsPanel is running.

To Reproduce Steps to reproduce the behavior:

  1. Open up this CodeSandbox https://codesandbox.io/s/dev-tools-panel-bug-fesez?file=/src/index.js
  2. Notice that the ReactQueryDevtoolsPanel on the right stays stuck in the "fetching" state while the ReactQueryDevtools component on the bottom updates correctly.
  3. Cause stale data to refetch (focus the window, toggle "Hide Users", whatever)
  4. The panel remains stuck in "fetching"

Expected behavior The two ReactQueryDevtools components should be in sync.

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Chrome/Safari
  • Version: 3.24.4
  1. TkDodo added labelspackage: react-query-devtools

  2. I didn't know that the ReactQueryDevtoolsPanel is exported for consumers. This is slightly related to https://github.com/tannerlinsley/react-query/issues/2742. We made a speedup and stoped subscriptions when the panel is closed. It means that the Panel now takes an isOpen property, and the effect to subscribe to changes is only setup when this is true.

    This was only meant as a workaround to avoid unnecessary renders of the Panel when it's closed and can be removed when/if #2742 is properly fixed. For now, a workaround would be to pass isOpen to the Panel so that the subscription is set up:

    <ReactQueryDevtoolsPanel isOpen />
  3. Believe it or not, it's recommended by the docs

    https://react-query.tanstack.com/devtools#embedded-mode

    That's a good workaround, though. Thanks!

  4. I would accept a PR that makes isOpen default to true if it's not passed because in the normal devtools, we pass the property depending on initialIsOpen/ the value stored in localhost anyways.

  5. TkDodo added labelsbug

  6. TkDodo added labelsgood first issue

  7. TkDodo closed this

  8. :tada: This issue has been resolved in version 3.24.5 :tada:

    The release is available on:

    Your semantic-release bot :package::rocket:

  9. tannerlinsley added labelsreleased

Sign in to join this conversation.