@tanstack/react-query-devtools 5.0.0-alpha.25 → 5.0.0-alpha.27
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/build/lib/__tests__/devtools.test.d.ts +0 -1
- package/build/lib/__tests__/devtools.test.d.ts.map +1 -0
- package/build/lib/__tests__/utils.d.ts.map +1 -0
- package/build/lib/devtools.d.ts +8 -30
- package/build/lib/devtools.d.ts.map +1 -0
- package/build/lib/devtools.esm.js +47 -226
- package/build/lib/devtools.esm.js.map +1 -1
- package/build/lib/devtools.js +45 -244
- package/build/lib/devtools.js.map +1 -1
- package/build/lib/devtools.mjs +47 -225
- package/build/lib/devtools.mjs.map +1 -1
- package/build/lib/index.d.ts +0 -1
- package/build/lib/index.d.ts.map +1 -0
- package/build/lib/index.esm.js +8 -5
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +7 -5
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +8 -5
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/index.prod.d.ts +0 -1
- package/build/lib/index.prod.esm.js +7901 -1501
- package/build/lib/index.prod.esm.js.map +1 -1
- package/build/lib/index.prod.js +7909 -1528
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +7922 -1489
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/umd/index.development.js +7146 -2375
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +4 -5
- package/src/__tests__/devtools.test.tsx +1 -1135
- package/src/devtools.tsx +52 -306
- package/src/index.ts +6 -6
- package/build/lib/CachePanel/ActiveQuery.d.ts +0 -19
- package/build/lib/CachePanel/ActiveQuery.esm.js +0 -277
- package/build/lib/CachePanel/ActiveQuery.esm.js.map +0 -1
- package/build/lib/CachePanel/ActiveQuery.js +0 -281
- package/build/lib/CachePanel/ActiveQuery.js.map +0 -1
- package/build/lib/CachePanel/ActiveQuery.mjs +0 -261
- package/build/lib/CachePanel/ActiveQuery.mjs.map +0 -1
- package/build/lib/CachePanel/CachePanel.d.ts +0 -58
- package/build/lib/CachePanel/CachePanel.esm.js +0 -310
- package/build/lib/CachePanel/CachePanel.esm.js.map +0 -1
- package/build/lib/CachePanel/CachePanel.js +0 -315
- package/build/lib/CachePanel/CachePanel.js.map +0 -1
- package/build/lib/CachePanel/CachePanel.mjs +0 -310
- package/build/lib/CachePanel/CachePanel.mjs.map +0 -1
- package/build/lib/CachePanel/Header/QueryStatusCount.d.ts +0 -8
- package/build/lib/CachePanel/Header/QueryStatusCount.esm.js +0 -49
- package/build/lib/CachePanel/Header/QueryStatusCount.esm.js.map +0 -1
- package/build/lib/CachePanel/Header/QueryStatusCount.js +0 -53
- package/build/lib/CachePanel/Header/QueryStatusCount.js.map +0 -1
- package/build/lib/CachePanel/Header/QueryStatusCount.mjs +0 -49
- package/build/lib/CachePanel/Header/QueryStatusCount.mjs.map +0 -1
- package/build/lib/CachePanel/QueryRow.d.ts +0 -14
- package/build/lib/CachePanel/QueryRow.esm.js +0 -98
- package/build/lib/CachePanel/QueryRow.esm.js.map +0 -1
- package/build/lib/CachePanel/QueryRow.js +0 -102
- package/build/lib/CachePanel/QueryRow.js.map +0 -1
- package/build/lib/CachePanel/QueryRow.mjs +0 -82
- package/build/lib/CachePanel/QueryRow.mjs.map +0 -1
- package/build/lib/Explorer.d.ts +0 -51
- package/build/lib/Explorer.esm.js +0 -254
- package/build/lib/Explorer.esm.js.map +0 -1
- package/build/lib/Explorer.js +0 -288
- package/build/lib/Explorer.js.map +0 -1
- package/build/lib/Explorer.mjs +0 -254
- package/build/lib/Explorer.mjs.map +0 -1
- package/build/lib/Logo.d.ts +0 -2
- package/build/lib/Logo.esm.js +0 -32
- package/build/lib/Logo.esm.js.map +0 -1
- package/build/lib/Logo.js +0 -55
- package/build/lib/Logo.js.map +0 -1
- package/build/lib/Logo.mjs +0 -32
- package/build/lib/Logo.mjs.map +0 -1
- package/build/lib/__tests__/Explorer.test.d.ts +0 -2
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +0 -17
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +0 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js +0 -19
- package/build/lib/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs +0 -17
- package/build/lib/_virtual/_rollupPluginBabelHelpers.mjs.map +0 -1
- package/build/lib/noop.d.ts +0 -3
- package/build/lib/screenreader.d.ts +0 -4
- package/build/lib/screenreader.esm.js +0 -17
- package/build/lib/screenreader.esm.js.map +0 -1
- package/build/lib/screenreader.js +0 -40
- package/build/lib/screenreader.js.map +0 -1
- package/build/lib/screenreader.mjs +0 -17
- package/build/lib/screenreader.mjs.map +0 -1
- package/build/lib/styledComponents.d.ts +0 -9
- package/build/lib/styledComponents.esm.js +0 -103
- package/build/lib/styledComponents.esm.js.map +0 -1
- package/build/lib/styledComponents.js +0 -112
- package/build/lib/styledComponents.js.map +0 -1
- package/build/lib/styledComponents.mjs +0 -103
- package/build/lib/styledComponents.mjs.map +0 -1
- package/build/lib/theme.d.ts +0 -37
- package/build/lib/theme.esm.js +0 -33
- package/build/lib/theme.esm.js.map +0 -1
- package/build/lib/theme.js +0 -56
- package/build/lib/theme.js.map +0 -1
- package/build/lib/theme.mjs +0 -33
- package/build/lib/theme.mjs.map +0 -1
- package/build/lib/types.d.ts +0 -12
- package/build/lib/useLocalStorage.d.ts +0 -2
- package/build/lib/useLocalStorage.esm.js +0 -40
- package/build/lib/useLocalStorage.esm.js.map +0 -1
- package/build/lib/useLocalStorage.js +0 -63
- package/build/lib/useLocalStorage.js.map +0 -1
- package/build/lib/useLocalStorage.mjs +0 -40
- package/build/lib/useLocalStorage.mjs.map +0 -1
- package/build/lib/useMediaQuery.d.ts +0 -2
- package/build/lib/useMediaQuery.esm.js +0 -36
- package/build/lib/useMediaQuery.esm.js.map +0 -1
- package/build/lib/useMediaQuery.js +0 -59
- package/build/lib/useMediaQuery.js.map +0 -1
- package/build/lib/useMediaQuery.mjs +0 -36
- package/build/lib/useMediaQuery.mjs.map +0 -1
- package/build/lib/useSubscribeToQueryCache.d.ts +0 -4
- package/build/lib/useSubscribeToQueryCache.esm.js +0 -15
- package/build/lib/useSubscribeToQueryCache.esm.js.map +0 -1
- package/build/lib/useSubscribeToQueryCache.js +0 -19
- package/build/lib/useSubscribeToQueryCache.js.map +0 -1
- package/build/lib/useSubscribeToQueryCache.mjs +0 -15
- package/build/lib/useSubscribeToQueryCache.mjs.map +0 -1
- package/build/lib/utils.d.ts +0 -80
- package/build/lib/utils.esm.js +0 -184
- package/build/lib/utils.esm.js.map +0 -1
- package/build/lib/utils.js +0 -218
- package/build/lib/utils.js.map +0 -1
- package/build/lib/utils.mjs +0 -184
- package/build/lib/utils.mjs.map +0 -1
- package/src/CachePanel/ActiveQuery.tsx +0 -388
- package/src/CachePanel/CachePanel.tsx +0 -439
- package/src/CachePanel/Header/QueryStatusCount.tsx +0 -93
- package/src/CachePanel/QueryRow.tsx +0 -125
- package/src/Explorer.tsx +0 -385
- package/src/Logo.tsx +0 -32
- package/src/__tests__/Explorer.test.tsx +0 -150
- package/src/noop.ts +0 -7
- package/src/screenreader.tsx +0 -16
- package/src/styledComponents.ts +0 -126
- package/src/theme.tsx +0 -33
- package/src/types.ts +0 -12
- package/src/useLocalStorage.ts +0 -52
- package/src/useMediaQuery.ts +0 -34
- package/src/useSubscribeToQueryCache.ts +0 -26
- package/src/utils.ts +0 -319
package/src/devtools.tsx
CHANGED
|
@@ -1,343 +1,89 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
import
|
|
2
|
+
import { useRef, useState, useEffect } from 'react'
|
|
3
3
|
import type { QueryClient } from '@tanstack/react-query'
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} from './utils'
|
|
13
|
-
import type { Corner, Side } from './utils'
|
|
14
|
-
import ScreenReader from './screenreader'
|
|
15
|
-
import { ThemeProvider, defaultTheme as theme } from './theme'
|
|
16
|
-
import Logo from './Logo'
|
|
17
|
-
|
|
18
|
-
import type { DevToolsErrorType } from './types'
|
|
19
|
-
import ReactQueryDevtoolsPanel from './CachePanel/CachePanel'
|
|
20
|
-
|
|
21
|
-
export { default as ReactQueryDevtoolsPanel } from './CachePanel/CachePanel'
|
|
22
|
-
|
|
4
|
+
import { useQueryClient, onlineManager } from '@tanstack/react-query'
|
|
5
|
+
import type {
|
|
6
|
+
DevtoolsButtonPosition,
|
|
7
|
+
DevtoolsPosition,
|
|
8
|
+
DevToolsErrorType,
|
|
9
|
+
} from '@tanstack/query-devtools'
|
|
10
|
+
import { TanstackQueryDevtools } from '@tanstack/query-devtools'
|
|
11
|
+
import React from 'react'
|
|
23
12
|
export interface DevtoolsOptions {
|
|
24
13
|
/**
|
|
25
14
|
* Set this true if you want the dev tools to default to being open
|
|
26
15
|
*/
|
|
27
16
|
initialIsOpen?: boolean
|
|
28
|
-
/**
|
|
29
|
-
* Use this to add props to the panel. For example, you can add className, style (merge and override default style), etc.
|
|
30
|
-
*/
|
|
31
|
-
panelProps?: React.ComponentPropsWithoutRef<'div'>
|
|
32
|
-
/**
|
|
33
|
-
* Use this to add props to the close button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
34
|
-
*/
|
|
35
|
-
closeButtonProps?: React.ComponentPropsWithoutRef<'button'>
|
|
36
|
-
/**
|
|
37
|
-
* Use this to add props to the toggle button. For example, you can add className, style (merge and override default style), onClick (extend default handler), etc.
|
|
38
|
-
*/
|
|
39
|
-
toggleButtonProps?: React.ComponentPropsWithoutRef<'button'>
|
|
40
17
|
/**
|
|
41
18
|
* The position of the React Query logo to open and close the devtools panel.
|
|
19
|
+
* 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
|
|
42
20
|
* Defaults to 'bottom-left'.
|
|
43
21
|
*/
|
|
44
|
-
|
|
22
|
+
buttonPosition?: DevtoolsButtonPosition
|
|
45
23
|
/**
|
|
46
24
|
* The position of the React Query devtools panel.
|
|
25
|
+
* 'top' | 'bottom' | 'left' | 'right'
|
|
47
26
|
* Defaults to 'bottom'.
|
|
48
27
|
*/
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Use this to render the devtools inside a different type of container element for a11y purposes.
|
|
52
|
-
* Any string which corresponds to a valid intrinsic JSX element is allowed.
|
|
53
|
-
* Defaults to 'aside'.
|
|
54
|
-
*/
|
|
55
|
-
containerElement?: string | any
|
|
56
|
-
/**
|
|
57
|
-
* nonce for style element for CSP
|
|
58
|
-
*/
|
|
59
|
-
styleNonce?: string
|
|
28
|
+
position?: DevtoolsPosition
|
|
60
29
|
/**
|
|
61
30
|
* Custom instance of QueryClient
|
|
62
31
|
*/
|
|
63
|
-
|
|
32
|
+
client?: QueryClient
|
|
64
33
|
/**
|
|
65
34
|
* Use this so you can define custom errors that can be shown in the devtools.
|
|
66
35
|
*/
|
|
67
36
|
errorTypes?: DevToolsErrorType[]
|
|
68
37
|
}
|
|
69
38
|
|
|
70
|
-
export function ReactQueryDevtools(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
position =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
)
|
|
88
|
-
const [devtoolsHeight, setDevtoolsHeight] = useLocalStorage<number>(
|
|
89
|
-
'reactQueryDevtoolsHeight',
|
|
90
|
-
defaultPanelSize,
|
|
91
|
-
)
|
|
92
|
-
const [devtoolsWidth, setDevtoolsWidth] = useLocalStorage<number>(
|
|
93
|
-
'reactQueryDevtoolsWidth',
|
|
94
|
-
defaultPanelSize,
|
|
39
|
+
export function ReactQueryDevtools(
|
|
40
|
+
props: DevtoolsOptions,
|
|
41
|
+
): React.ReactElement | null {
|
|
42
|
+
const queryClient = useQueryClient()
|
|
43
|
+
const ref = useRef<HTMLDivElement>(null)
|
|
44
|
+
const { buttonPosition, position, initialIsOpen, errorTypes } = props
|
|
45
|
+
const [devtools] = useState(
|
|
46
|
+
new TanstackQueryDevtools({
|
|
47
|
+
client: props.client || queryClient,
|
|
48
|
+
queryFlavor: 'React Query',
|
|
49
|
+
version: '5',
|
|
50
|
+
onlineManager,
|
|
51
|
+
buttonPosition,
|
|
52
|
+
position,
|
|
53
|
+
initialIsOpen,
|
|
54
|
+
errorTypes,
|
|
55
|
+
}),
|
|
95
56
|
)
|
|
96
57
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
const [isResolvedOpen, setIsResolvedOpen] = React.useState(false)
|
|
103
|
-
const [isResizing, setIsResizing] = React.useState(false)
|
|
104
|
-
const isMounted = useIsMounted()
|
|
105
|
-
|
|
106
|
-
const handleDragStart = (
|
|
107
|
-
panelElement: HTMLDivElement | null,
|
|
108
|
-
startEvent: React.MouseEvent<HTMLDivElement, MouseEvent>,
|
|
109
|
-
) => {
|
|
110
|
-
if (!panelElement) return
|
|
111
|
-
if (startEvent.button !== 0) return // Only allow left click for drag
|
|
112
|
-
const isVertical = isVerticalSide(panelPosition)
|
|
113
|
-
setIsResizing(true)
|
|
114
|
-
|
|
115
|
-
const { height, width } = panelElement.getBoundingClientRect()
|
|
116
|
-
const startX = startEvent.clientX
|
|
117
|
-
const startY = startEvent.clientY
|
|
118
|
-
let newSize = 0
|
|
119
|
-
|
|
120
|
-
const run = (moveEvent: MouseEvent) => {
|
|
121
|
-
// prevent mouse selecting stuff with mouse drag
|
|
122
|
-
moveEvent.preventDefault()
|
|
123
|
-
|
|
124
|
-
// calculate the correct size based on mouse position and current panel position
|
|
125
|
-
// hint: it is different formula for the opposite sides
|
|
126
|
-
if (isVertical) {
|
|
127
|
-
newSize =
|
|
128
|
-
width +
|
|
129
|
-
(panelPosition === 'right'
|
|
130
|
-
? startX - moveEvent.clientX
|
|
131
|
-
: moveEvent.clientX - startX)
|
|
132
|
-
setDevtoolsWidth(newSize)
|
|
133
|
-
} else {
|
|
134
|
-
newSize =
|
|
135
|
-
height +
|
|
136
|
-
(panelPosition === 'bottom'
|
|
137
|
-
? startY - moveEvent.clientY
|
|
138
|
-
: moveEvent.clientY - startY)
|
|
139
|
-
setDevtoolsHeight(newSize)
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
if (newSize < minPanelSize) {
|
|
143
|
-
setIsOpen(false)
|
|
144
|
-
} else {
|
|
145
|
-
setIsOpen(true)
|
|
146
|
-
}
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (buttonPosition) {
|
|
60
|
+
devtools.setButtonPosition(buttonPosition)
|
|
147
61
|
}
|
|
62
|
+
}, [buttonPosition, devtools])
|
|
148
63
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
document.removeEventListener('mousemove', run, false)
|
|
155
|
-
document.removeEventListener('mouseUp', unsub, false)
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
if (position) {
|
|
66
|
+
devtools.setPosition(position)
|
|
156
67
|
}
|
|
68
|
+
}, [position, devtools])
|
|
157
69
|
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
React.useEffect(() => {
|
|
163
|
-
setIsResolvedOpen(isOpen ?? false)
|
|
164
|
-
}, [isOpen, isResolvedOpen, setIsResolvedOpen])
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
devtools.setInitialIsOpen(initialIsOpen || false)
|
|
72
|
+
}, [initialIsOpen, devtools])
|
|
165
73
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
const ref = panelRef.current
|
|
170
|
-
if (ref) {
|
|
171
|
-
const handlePanelTransitionStart = () => {
|
|
172
|
-
if (isResolvedOpen) {
|
|
173
|
-
ref.style.visibility = 'visible'
|
|
174
|
-
}
|
|
175
|
-
}
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
devtools.setErrorTypes(errorTypes || [])
|
|
76
|
+
}, [errorTypes, devtools])
|
|
176
77
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
ref.addEventListener('transitionstart', handlePanelTransitionStart)
|
|
184
|
-
ref.addEventListener('transitionend', handlePanelTransitionEnd)
|
|
185
|
-
|
|
186
|
-
return () => {
|
|
187
|
-
ref.removeEventListener('transitionstart', handlePanelTransitionStart)
|
|
188
|
-
ref.removeEventListener('transitionend', handlePanelTransitionEnd)
|
|
189
|
-
}
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (ref.current) {
|
|
80
|
+
devtools.mount(ref.current)
|
|
190
81
|
}
|
|
191
|
-
return
|
|
192
|
-
}, [isResolvedOpen])
|
|
193
|
-
|
|
194
|
-
React.useEffect(() => {
|
|
195
|
-
if (isResolvedOpen && rootRef.current?.parentElement) {
|
|
196
|
-
const { parentElement } = rootRef.current
|
|
197
|
-
const styleProp = getSidedProp('padding', panelPosition)
|
|
198
|
-
const isVertical = isVerticalSide(panelPosition)
|
|
199
|
-
|
|
200
|
-
const previousPaddings = (({
|
|
201
|
-
padding,
|
|
202
|
-
paddingTop,
|
|
203
|
-
paddingBottom,
|
|
204
|
-
paddingLeft,
|
|
205
|
-
paddingRight,
|
|
206
|
-
}) => ({
|
|
207
|
-
padding,
|
|
208
|
-
paddingTop,
|
|
209
|
-
paddingBottom,
|
|
210
|
-
paddingLeft,
|
|
211
|
-
paddingRight,
|
|
212
|
-
}))(parentElement.style)
|
|
213
82
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
parentElement.style.padding = '0px'
|
|
217
|
-
parentElement.style.paddingTop = '0px'
|
|
218
|
-
parentElement.style.paddingBottom = '0px'
|
|
219
|
-
parentElement.style.paddingLeft = '0px'
|
|
220
|
-
parentElement.style.paddingRight = '0px'
|
|
221
|
-
// set the new padding based on the new panel position
|
|
222
|
-
|
|
223
|
-
parentElement.style[styleProp] = `${
|
|
224
|
-
isVertical ? devtoolsWidth : devtoolsHeight
|
|
225
|
-
}px`
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
run()
|
|
229
|
-
|
|
230
|
-
if (typeof window !== 'undefined') {
|
|
231
|
-
window.addEventListener('resize', run)
|
|
232
|
-
|
|
233
|
-
return () => {
|
|
234
|
-
window.removeEventListener('resize', run)
|
|
235
|
-
Object.entries(previousPaddings).forEach(
|
|
236
|
-
([property, previousValue]) => {
|
|
237
|
-
parentElement.style[property as keyof typeof previousPaddings] =
|
|
238
|
-
previousValue
|
|
239
|
-
},
|
|
240
|
-
)
|
|
241
|
-
}
|
|
242
|
-
}
|
|
83
|
+
return () => {
|
|
84
|
+
devtools.unmount()
|
|
243
85
|
}
|
|
244
|
-
|
|
245
|
-
}, [isResolvedOpen, panelPosition, devtoolsHeight, devtoolsWidth])
|
|
246
|
-
|
|
247
|
-
const { style: panelStyle = {}, ...otherPanelProps } = panelProps
|
|
86
|
+
}, [devtools])
|
|
248
87
|
|
|
249
|
-
|
|
250
|
-
style: toggleButtonStyle = {},
|
|
251
|
-
onClick: onToggleClick,
|
|
252
|
-
...otherToggleButtonProps
|
|
253
|
-
} = toggleButtonProps
|
|
254
|
-
|
|
255
|
-
// get computed style based on panel position
|
|
256
|
-
const style = getSidePanelStyle({
|
|
257
|
-
position: panelPosition,
|
|
258
|
-
devtoolsTheme: theme,
|
|
259
|
-
isOpen: isResolvedOpen,
|
|
260
|
-
height: devtoolsHeight,
|
|
261
|
-
width: devtoolsWidth,
|
|
262
|
-
isResizing,
|
|
263
|
-
panelStyle,
|
|
264
|
-
})
|
|
265
|
-
|
|
266
|
-
// Do not render on the server
|
|
267
|
-
if (!isMounted()) return null
|
|
268
|
-
|
|
269
|
-
return (
|
|
270
|
-
<Container
|
|
271
|
-
ref={rootRef}
|
|
272
|
-
className="ReactQueryDevtools"
|
|
273
|
-
aria-label="React Query Devtools"
|
|
274
|
-
>
|
|
275
|
-
<ThemeProvider theme={theme}>
|
|
276
|
-
<ReactQueryDevtoolsPanel
|
|
277
|
-
ref={panelRef as any}
|
|
278
|
-
queryClient={queryClient}
|
|
279
|
-
styleNonce={styleNonce}
|
|
280
|
-
position={panelPosition}
|
|
281
|
-
onPositionChange={setPanelPosition}
|
|
282
|
-
showCloseButton
|
|
283
|
-
closeButtonProps={closeButtonProps}
|
|
284
|
-
{...otherPanelProps}
|
|
285
|
-
style={style}
|
|
286
|
-
isOpen={isResolvedOpen}
|
|
287
|
-
setIsOpen={setIsOpen}
|
|
288
|
-
onDragStart={(e) => handleDragStart(panelRef.current, e)}
|
|
289
|
-
errorTypes={errorTypes}
|
|
290
|
-
/>
|
|
291
|
-
</ThemeProvider>
|
|
292
|
-
{!isResolvedOpen ? (
|
|
293
|
-
<button
|
|
294
|
-
type="button"
|
|
295
|
-
{...otherToggleButtonProps}
|
|
296
|
-
aria-label="Open React Query Devtools"
|
|
297
|
-
aria-controls="ReactQueryDevtoolsPanel"
|
|
298
|
-
aria-haspopup="true"
|
|
299
|
-
aria-expanded="false"
|
|
300
|
-
onClick={(e) => {
|
|
301
|
-
setIsOpen(true)
|
|
302
|
-
onToggleClick?.(e)
|
|
303
|
-
}}
|
|
304
|
-
style={{
|
|
305
|
-
background: 'none',
|
|
306
|
-
border: 0,
|
|
307
|
-
padding: 0,
|
|
308
|
-
position: 'fixed',
|
|
309
|
-
zIndex: 99999,
|
|
310
|
-
display: 'inline-flex',
|
|
311
|
-
fontSize: '1.5em',
|
|
312
|
-
margin: '.5em',
|
|
313
|
-
cursor: 'pointer',
|
|
314
|
-
width: 'fit-content',
|
|
315
|
-
...(position === 'top-right'
|
|
316
|
-
? {
|
|
317
|
-
top: '0',
|
|
318
|
-
right: '0',
|
|
319
|
-
}
|
|
320
|
-
: position === 'top-left'
|
|
321
|
-
? {
|
|
322
|
-
top: '0',
|
|
323
|
-
left: '0',
|
|
324
|
-
}
|
|
325
|
-
: position === 'bottom-right'
|
|
326
|
-
? {
|
|
327
|
-
bottom: '0',
|
|
328
|
-
right: '0',
|
|
329
|
-
}
|
|
330
|
-
: {
|
|
331
|
-
bottom: '0',
|
|
332
|
-
left: '0',
|
|
333
|
-
}),
|
|
334
|
-
...toggleButtonStyle,
|
|
335
|
-
}}
|
|
336
|
-
>
|
|
337
|
-
<Logo aria-hidden />
|
|
338
|
-
<ScreenReader text="Open React Query Devtools" />
|
|
339
|
-
</button>
|
|
340
|
-
) : null}
|
|
341
|
-
</Container>
|
|
342
|
-
)
|
|
88
|
+
return <div ref={ref}></div>
|
|
343
89
|
}
|
package/src/index.ts
CHANGED
|
@@ -9,9 +9,9 @@ export const ReactQueryDevtools: (typeof devtools)['ReactQueryDevtools'] =
|
|
|
9
9
|
}
|
|
10
10
|
: devtools.ReactQueryDevtools
|
|
11
11
|
|
|
12
|
-
export const ReactQueryDevtoolsPanel: (typeof devtools)['ReactQueryDevtoolsPanel'] =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
// export const ReactQueryDevtoolsPanel: (typeof devtools)['ReactQueryDevtoolsPanel'] =
|
|
13
|
+
// process.env.NODE_ENV !== 'development'
|
|
14
|
+
// ? (function () {
|
|
15
|
+
// return null
|
|
16
|
+
// } as any)
|
|
17
|
+
// : devtools.ReactQueryDevtoolsPanel
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { QueryCache, QueryClient } from '@tanstack/react-query';
|
|
2
|
-
import type { DevToolsErrorType } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* Panel for the query currently being inspected
|
|
5
|
-
*
|
|
6
|
-
* It displays query details (key, observers...), query actions,
|
|
7
|
-
* the data explorer and the query explorer
|
|
8
|
-
*/
|
|
9
|
-
declare const ActiveQuery: {
|
|
10
|
-
({ queryCache, activeQueryHash, queryClient, errorTypes, }: {
|
|
11
|
-
queryCache: QueryCache;
|
|
12
|
-
activeQueryHash: string;
|
|
13
|
-
queryClient: QueryClient;
|
|
14
|
-
errorTypes: DevToolsErrorType[];
|
|
15
|
-
}): JSX.Element | null;
|
|
16
|
-
displayName: string;
|
|
17
|
-
};
|
|
18
|
-
export default ActiveQuery;
|
|
19
|
-
//# sourceMappingURL=ActiveQuery.d.ts.map
|