@tanstack/solid-query-devtools 6.0.0-beta.3 → 6.0.0-beta.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/solid-query-devtools",
3
- "version": "6.0.0-beta.3",
3
+ "version": "6.0.0-beta.5",
4
4
  "description": "Developer tools to interact with and visualize the TanStack/solid-query Query cache",
5
5
  "author": "tannerlinsley",
6
6
  "license": "MIT",
@@ -44,23 +44,23 @@
44
44
  "!src/__tests__"
45
45
  ],
46
46
  "dependencies": {
47
- "@tanstack/query-devtools": "5.93.0"
47
+ "@tanstack/query-devtools": "5.101.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@babel/core": "^7.28.0",
51
51
  "@babel/preset-typescript": "^7.18.6",
52
52
  "@solidjs/testing-library": "^0.8.10",
53
- "@solidjs/web": "2.0.0-beta.4",
54
- "babel-preset-solid": "2.0.0-beta.4",
53
+ "@solidjs/web": "2.0.0-beta.15",
54
+ "babel-preset-solid": "2.0.0-beta.15",
55
55
  "npm-run-all2": "^5.0.0",
56
- "solid-js": "2.0.0-beta.5",
56
+ "solid-js": "2.0.0-beta.15",
57
57
  "tsup-preset-solid": "^2.2.0",
58
- "vite-plugin-solid": "3.0.0-next.4",
59
- "@tanstack/solid-query": "6.0.0-beta.3"
58
+ "vite-plugin-solid": "3.0.0-next.5",
59
+ "@tanstack/solid-query": "6.0.0-beta.5"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "solid-js": ">=2.0.0-beta.0 <3.0.0",
63
- "@tanstack/solid-query": "^6.0.0-beta.3"
63
+ "@tanstack/solid-query": "^6.0.0-beta.5"
64
64
  },
65
65
  "scripts": {
66
66
  "clean": "premove ./build ./coverage ./dist-ts",
@@ -7,7 +7,8 @@ import {
7
7
  untrack,
8
8
  } from 'solid-js'
9
9
  import { isServer } from '@solidjs/web'
10
- import type { Component, ComponentProps, JSX } from 'solid-js'
10
+ import type { Component, ComponentProps } from 'solid-js'
11
+ import type { JSX } from '@solidjs/web'
11
12
 
12
13
  /*
13
14
  This function has been taken from solid-start's codebase
package/src/devtools.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { createEffect, createMemo, onCleanup } from 'solid-js'
1
+ import { createEffect, createMemo, onSettled, runWithOwner } from 'solid-js'
2
2
  import { onlineManager, useQueryClient } from '@tanstack/solid-query'
3
3
  import { TanstackQueryDevtools } from '@tanstack/query-devtools'
4
4
  import type {
@@ -15,13 +15,13 @@ interface DevtoolsOptions {
15
15
  */
16
16
  initialIsOpen?: boolean
17
17
  /**
18
- * The position of the React Query logo to open and close the devtools panel.
19
- * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
18
+ * The position of the TanStack logo to open and close the devtools panel.
19
+ * 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'relative'
20
20
  * Defaults to 'bottom-right'.
21
21
  */
22
22
  buttonPosition?: DevtoolsButtonPosition
23
23
  /**
24
- * The position of the React Query devtools panel.
24
+ * The position of the Solid Query devtools panel.
25
25
  * 'top' | 'bottom' | 'left' | 'right'
26
26
  * Defaults to 'bottom'.
27
27
  */
@@ -118,19 +118,23 @@ export default function SolidQueryDevtools(props: DevtoolsOptions) {
118
118
  },
119
119
  )
120
120
 
121
- let isMounted = false
122
- let isDisposed = false
123
-
124
- queueMicrotask(() => {
125
- if (isDisposed) return
126
- devtools.mount(ref)
127
- isMounted = true
128
- })
129
-
130
- onCleanup(() => {
131
- isDisposed = true
132
- if (isMounted) {
133
- devtools.unmount()
121
+ // devtools.mount() calls render() from solid-js/web, which calls flush().
122
+ // flush() is not reentrant inside onSettled, so defer the mount to a
123
+ // microtask. runWithOwner(null) escapes the owned scope because
124
+ // devtools.mount renders a nested Solid app (creating reactive primitives).
125
+ let mounted = false
126
+ let disposed = false
127
+ onSettled(() => {
128
+ queueMicrotask(() => {
129
+ if (disposed) return
130
+ runWithOwner(null, () => devtools.mount(ref))
131
+ mounted = true
132
+ })
133
+ return () => {
134
+ disposed = true
135
+ if (mounted) {
136
+ devtools.unmount()
137
+ }
134
138
  }
135
139
  })
136
140
 
@@ -1,9 +1,9 @@
1
- import { createEffect, createMemo, onCleanup } from 'solid-js'
1
+ import { createEffect, createMemo, onSettled, runWithOwner } from 'solid-js'
2
2
  import { onlineManager, useQueryClient } from '@tanstack/solid-query'
3
3
  import { TanstackQueryDevtoolsPanel } from '@tanstack/query-devtools'
4
4
  import type { DevtoolsErrorType, Theme } from '@tanstack/query-devtools'
5
5
  import type { QueryClient } from '@tanstack/solid-query'
6
- import type { JSX } from 'solid-js'
6
+ import type { JSX } from '@solidjs/web'
7
7
 
8
8
  export interface DevtoolsPanelOptions {
9
9
  /**
@@ -34,7 +34,7 @@ export interface DevtoolsPanelOptions {
34
34
  /**
35
35
  * Callback function that is called when the devtools panel is closed
36
36
  */
37
- onClose?: () => unknown
37
+ onClose?: () => void
38
38
  /**
39
39
  * Set this to true to hide disabled queries from the devtools panel.
40
40
  */
@@ -93,19 +93,23 @@ export default function SolidQueryDevtoolsPanel(props: DevtoolsPanelOptions) {
93
93
  },
94
94
  )
95
95
 
96
- let isMounted = false
97
- let isDisposed = false
98
-
99
- queueMicrotask(() => {
100
- if (isDisposed) return
101
- devtools.mount(ref)
102
- isMounted = true
103
- })
104
-
105
- onCleanup(() => {
106
- isDisposed = true
107
- if (isMounted) {
108
- devtools.unmount()
96
+ // devtools.mount() calls render() from solid-js/web, which calls flush().
97
+ // flush() is not reentrant inside onSettled, so defer the mount to a
98
+ // microtask. runWithOwner(null) escapes the owned scope because
99
+ // devtools.mount renders a nested Solid app (creating reactive primitives).
100
+ let mounted = false
101
+ let disposed = false
102
+ onSettled(() => {
103
+ queueMicrotask(() => {
104
+ if (disposed) return
105
+ runWithOwner(null, () => devtools.mount(ref))
106
+ mounted = true
107
+ })
108
+ return () => {
109
+ disposed = true
110
+ if (mounted) {
111
+ devtools.unmount()
112
+ }
109
113
  }
110
114
  })
111
115