-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
broadcastClient: removing query from one tab removes it from all tabs, even if others still have observers #7487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the reproduction. I think the issue is mostly that we are listening to query/packages/query-broadcast-client-experimental/src/index.ts Lines 39 to 55 in 280682e
I don't fully understand your fix around query/packages/query-core/src/queryCache.ts Lines 71 to 78 in 61f4d74
|
i will try the the (obviously not the correct implementation, just a demo) edit: tried adding the |
I have an idea how to fix this. Can you assign this issue to me please? |
Describe the bug
When using
broadcastQueryClient
:Your minimal, reproducible example
(no stackblitz as their containerization seems to break broadcast channels, but see "Steps to reproduce" for a repo, also I've recorded a video demo)
Steps to reproduce
Sample repo: https://github.com/c-ehrlich/broadcast-invalidation-demo
To see the bug
cd before
,pnpm i
,pnpm dev
To see a demo of my rough fix
cd after
,pnpm i
,pnpm dev
Expected behavior
(not sure what the intended behaviour is, but these would be my expectations for the broadcastClient)
How often does this bug happen?
Every time
Screenshots or Videos
https://www.loom.com/share/e7da8b5d3cdb4b36a3fbf076d7ccb6b8
(the data updates twice shortly after each other at 1:16 because i had a third tab open, see "Additional context")
Platform
Chrome 124.0.6367.208 on MacOS 14.3 (also confirmed in Firefox on Windows 11)
Tanstack Query adapter
react-query
TanStack Query version
5.39.0
TypeScript version
5.2.2
Additional context
My implementation still has one significant inefficiency:
Other considerations:
The text was updated successfully, but these errors were encountered: