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:
- Open up this CodeSandbox https://codesandbox.io/s/dev-tools-panel-bug-fesez?file=/src/index.js
- Notice that the ReactQueryDevtoolsPanel on the right stays stuck in the "fetching" state while the ReactQueryDevtools component on the bottom updates correctly.
- Cause stale data to refetch (focus the window, toggle "Hide Users", whatever)
- 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
I didn't know that the
ReactQueryDevtoolsPanelis 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 anisOpenproperty, and the effect to subscribe to changes is only setup when this istrue.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
isOpento the Panel so that the subscription is set up: