# TanStack Query: sync query invalidations across tabs

Canonical source : [TanStack Query: sync query invalidations across tabs](<https://sebastien.rigaux.be/en/tech-watch/links/tanstack-query-sync-query-invalidations-across-tabs>)

To keep views consistent across tabs, this article recommends broadcasting only the **query key to invalidate**, then letting each tab fetch its own data with its own filters, authentication, and error handling. The example uses `BroadcastChannel` and a listener mounted once near `QueryClientProvider`.

Invalidation marks matching queries stale; only active queries refetch immediately. The same mechanism can signal a logout, but the server remains responsible for revoking the session: a closed or frozen tab may miss the message.

- Selected on : 2026-11-09

- Resource publication : 2026-10-30

- Entry updated : 2026-11-09T08:38:25+0000

- Format : Article

- Source language : EN

- Credit : @

- Found via : [React Digest](<https://reactdigest.net/>)

Original resource : [TanStack Query: sync query invalidations across tabs](<https://dev.to/idanshalem/keeping-tanstack-query-fresh-across-tabs-2k80>)

Tags : [TanStack Query](<https://sebastien.rigaux.be/en/tech-watch/tags/tanstack-query>)

Available versions : [Français](<https://sebastien.rigaux.be/veille/liens/tanstack-query-synchroniser-les-invalidations-entre-onglets>) · [English](<https://sebastien.rigaux.be/en/tech-watch/links/tanstack-query-sync-query-invalidations-across-tabs>)

[Back to tech watch](<https://sebastien.rigaux.be/en/tech-watch>)
