Skip to content
Source
Sign inSign up
TanStack/query

fix(query-devtools): isolate devtools state per mounted instance 🤖🤖🤖 #11798

Closedaakashthapa0(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/11798/headopened View on GitHub

Showing 8 changed files with 21 additions and 6 deletions (loading 6).

x
0 of 8 viewed, 8 left
5 additions and 0 deletions.changeset/tidy-pandas-switch.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/query-devtools': patch
+---
+​
+Fix devtools state leaking between multiple mounted devtools instances. The selected query/mutation, panel width, and offline-indicator signals were created once at module scope, so interacting with one panel (e.g. selecting a query) affected every other panel on the page. They are now created per devtools instance via a new `DevtoolsStateProvider` context. The query/mutation cache subscription registries are scoped per instance as well, so cache updates for one client's cache no longer invoke other panels' callbacks and unmounting one panel no longer clears the others' subscriptions. The online/offline subscription also moved into the provider so panel-only instances reflect their configured `onlineManager`.
16 additions and 6 deletionspackages/query-devtools/src/__tests__/Devtools.test.tsxModified
View file
@@ -10,7 +10,12 @@
import { fireEvent, render } from '@solidjs/testing-library'
import { createLocalStorage } from '@solid-primitives/storage'
import { Devtools } from '../Devtools'
-import { PiPProvider, QueryDevtoolsContext, ThemeContext } from '../contexts'
+import {
+ DevtoolsStateProvider,
+ PiPProvider,
+ QueryDevtoolsContext,
+ ThemeContext,
+} from '../contexts'
import type { QueryDevtoolsProps } from '../contexts'
​
// `solid-transition-group` internally imports from
@@ -126,11 +131,16 @@