@tanstack/devtools 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dev.js CHANGED
@@ -30,7 +30,7 @@ var TanStackDevtoolsCore = class {
30
30
  const mountTo = el;
31
31
  const dispose = render(() => {
32
32
  const _self$ = this;
33
- this.#Component = lazy(() => import('./devtools/OLELRPKB.js'));
33
+ this.#Component = lazy(() => import('./devtools/GGWR254Q.js'));
34
34
  const Devtools = this.#Component;
35
35
  this.#eventBus = new ClientEventBus(this.#eventBusConfig);
36
36
  this.#eventBus.start();
@@ -93,6 +93,12 @@ var usePlugins = () => {
93
93
  const toggleActivePlugins = (pluginId) => {
94
94
  setStore((prev) => {
95
95
  const isActive = prev.state.activePlugins.includes(pluginId);
96
+ const currentPlugin = store.plugins?.find(
97
+ (plugin) => plugin.id === pluginId
98
+ );
99
+ if (currentPlugin?.destroy && isActive) {
100
+ currentPlugin.destroy(pluginId);
101
+ }
96
102
  const updatedPlugins = isActive ? prev.state.activePlugins.filter((id) => id !== pluginId) : [...prev.state.activePlugins, pluginId];
97
103
  if (updatedPlugins.length > MAX_ACTIVE_PLUGINS) return prev;
98
104
  return {
@@ -93,6 +93,12 @@ var usePlugins = () => {
93
93
  const toggleActivePlugins = (pluginId) => {
94
94
  setStore((prev) => {
95
95
  const isActive = prev.state.activePlugins.includes(pluginId);
96
+ const currentPlugin = store.plugins?.find(
97
+ (plugin) => plugin.id === pluginId
98
+ );
99
+ if (currentPlugin?.destroy && isActive) {
100
+ currentPlugin.destroy(pluginId);
101
+ }
96
102
  const updatedPlugins = isActive ? prev.state.activePlugins.filter((id) => id !== pluginId) : [...prev.state.activePlugins, pluginId];
97
103
  if (updatedPlugins.length > MAX_ACTIVE_PLUGINS) return prev;
98
104
  return {
package/dist/index.d.ts CHANGED
@@ -144,6 +144,7 @@ interface TanStackDevtoolsPlugin {
144
144
  * ```
145
145
  */
146
146
  render: (el: HTMLDivElement, theme: DevtoolsStore['settings']['theme']) => void;
147
+ destroy?: (pluginId: string) => void;
147
148
  }
148
149
  type TanStackDevtoolsConfig = DevtoolsStore['settings'];
149
150
 
package/dist/index.js CHANGED
@@ -30,7 +30,7 @@ var TanStackDevtoolsCore = class {
30
30
  const mountTo = el;
31
31
  const dispose = render(() => {
32
32
  const _self$ = this;
33
- this.#Component = lazy(() => import('./devtools/OLELRPKB.js'));
33
+ this.#Component = lazy(() => import('./devtools/GGWR254Q.js'));
34
34
  const Devtools = this.#Component;
35
35
  this.#eventBus = new ClientEventBus(this.#eventBusConfig);
36
36
  this.#eventBus.start();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/devtools",
3
- "version": "0.8.1",
3
+ "version": "0.8.2",
4
4
  "description": "TanStack Devtools is a set of tools for building advanced devtools for your application.",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -73,6 +73,8 @@ export interface TanStackDevtoolsPlugin {
73
73
  el: HTMLDivElement,
74
74
  theme: DevtoolsStore['settings']['theme'],
75
75
  ) => void
76
+
77
+ destroy?: (pluginId: string) => void
76
78
  }
77
79
  export const DevtoolsContext = createContext<{
78
80
  store: DevtoolsStore
@@ -48,6 +48,14 @@ export const usePlugins = () => {
48
48
  setStore((prev) => {
49
49
  const isActive = prev.state.activePlugins.includes(pluginId)
50
50
 
51
+ const currentPlugin = store.plugins?.find(
52
+ (plugin) => plugin.id === pluginId,
53
+ )
54
+
55
+ if (currentPlugin?.destroy && isActive) {
56
+ currentPlugin.destroy(pluginId)
57
+ }
58
+
51
59
  const updatedPlugins = isActive
52
60
  ? prev.state.activePlugins.filter((id) => id !== pluginId)
53
61
  : [...prev.state.activePlugins, pluginId]