@tanstack/react-query-devtools 5.0.0-alpha.2 → 5.0.0-alpha.21
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/CachePanel/ActiveQuery.d.ts +18 -0
- package/build/lib/CachePanel/ActiveQuery.esm.js +271 -0
- package/build/lib/CachePanel/ActiveQuery.esm.js.map +1 -0
- package/build/lib/CachePanel/ActiveQuery.js +275 -0
- package/build/lib/CachePanel/ActiveQuery.js.map +1 -0
- package/build/lib/CachePanel/ActiveQuery.mjs +257 -0
- package/build/lib/CachePanel/ActiveQuery.mjs.map +1 -0
- package/build/lib/CachePanel/CachePanel.d.ts +57 -0
- package/build/lib/CachePanel/CachePanel.esm.js +310 -0
- package/build/lib/CachePanel/CachePanel.esm.js.map +1 -0
- package/build/lib/CachePanel/CachePanel.js +315 -0
- package/build/lib/CachePanel/CachePanel.js.map +1 -0
- package/build/lib/CachePanel/CachePanel.mjs +310 -0
- package/build/lib/CachePanel/CachePanel.mjs.map +1 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.d.ts +7 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.esm.js +49 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.esm.js.map +1 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.js +53 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.js.map +1 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.mjs +49 -0
- package/build/lib/CachePanel/Header/QueryStatusCount.mjs.map +1 -0
- package/build/lib/CachePanel/QueryRow.d.ts +13 -0
- package/build/lib/CachePanel/QueryRow.esm.js +98 -0
- package/build/lib/CachePanel/QueryRow.esm.js.map +1 -0
- package/build/lib/CachePanel/QueryRow.js +102 -0
- package/build/lib/CachePanel/QueryRow.js.map +1 -0
- package/build/lib/CachePanel/QueryRow.mjs +82 -0
- package/build/lib/CachePanel/QueryRow.mjs.map +1 -0
- package/build/lib/Explorer.esm.js +2 -1
- package/build/lib/Explorer.esm.js.map +1 -1
- package/build/lib/Explorer.js +2 -1
- package/build/lib/Explorer.js.map +1 -1
- package/build/lib/Explorer.mjs +1 -0
- package/build/lib/Explorer.mjs.map +1 -1
- package/build/lib/devtools.d.ts +5 -48
- package/build/lib/devtools.esm.js +11 -550
- package/build/lib/devtools.esm.js.map +1 -1
- package/build/lib/devtools.js +12 -551
- package/build/lib/devtools.js.map +1 -1
- package/build/lib/devtools.mjs +7 -547
- package/build/lib/devtools.mjs.map +1 -1
- package/build/lib/index.esm.js +3 -1
- package/build/lib/index.esm.js.map +1 -1
- package/build/lib/index.js +3 -1
- package/build/lib/index.js.map +1 -1
- package/build/lib/index.mjs +3 -1
- package/build/lib/index.mjs.map +1 -1
- package/build/lib/index.prod.esm.js +821 -651
- package/build/lib/index.prod.esm.js.map +1 -1
- package/build/lib/index.prod.js +819 -650
- package/build/lib/index.prod.js.map +1 -1
- package/build/lib/index.prod.mjs +764 -625
- package/build/lib/index.prod.mjs.map +1 -1
- package/build/lib/styledComponents.d.ts +0 -1
- package/build/lib/styledComponents.esm.js +11 -1
- package/build/lib/styledComponents.esm.js.map +1 -1
- package/build/lib/styledComponents.js +11 -1
- package/build/lib/styledComponents.js.map +1 -1
- package/build/lib/styledComponents.mjs +11 -1
- package/build/lib/styledComponents.mjs.map +1 -1
- package/build/lib/theme.esm.js +1 -0
- package/build/lib/theme.esm.js.map +1 -1
- package/build/lib/theme.js +1 -0
- package/build/lib/theme.js.map +1 -1
- package/build/lib/theme.mjs +1 -0
- package/build/lib/theme.mjs.map +1 -1
- package/build/lib/types.d.ts +11 -0
- package/build/lib/useSubscribeToQueryCache.d.ts +3 -0
- package/build/lib/useSubscribeToQueryCache.esm.js +15 -0
- package/build/lib/useSubscribeToQueryCache.esm.js.map +1 -0
- package/build/lib/useSubscribeToQueryCache.js +19 -0
- package/build/lib/useSubscribeToQueryCache.js.map +1 -0
- package/build/lib/useSubscribeToQueryCache.mjs +15 -0
- package/build/lib/useSubscribeToQueryCache.mjs.map +1 -0
- package/build/umd/index.development.js +1667 -1529
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +4 -4
- package/src/CachePanel/ActiveQuery.tsx +380 -0
- package/src/CachePanel/CachePanel.tsx +439 -0
- package/src/CachePanel/Header/QueryStatusCount.tsx +93 -0
- package/src/CachePanel/QueryRow.tsx +125 -0
- package/src/__tests__/Explorer.test.tsx +3 -2
- package/src/__tests__/devtools.test.tsx +229 -9
- package/src/devtools.tsx +10 -865
- package/src/styledComponents.ts +19 -1
- package/src/types.ts +12 -0
- package/src/useSubscribeToQueryCache.ts +26 -0
package/src/styledComponents.ts
CHANGED
|
@@ -20,6 +20,8 @@ export const Panel = styled(
|
|
|
20
20
|
},
|
|
21
21
|
)
|
|
22
22
|
|
|
23
|
+
Panel.displayName = 'Panel'
|
|
24
|
+
|
|
23
25
|
export const ActiveQueryPanel = styled(
|
|
24
26
|
'div',
|
|
25
27
|
() => ({
|
|
@@ -36,6 +38,8 @@ export const ActiveQueryPanel = styled(
|
|
|
36
38
|
},
|
|
37
39
|
)
|
|
38
40
|
|
|
41
|
+
ActiveQueryPanel.displayName = 'ActiveQueryPanel'
|
|
42
|
+
|
|
39
43
|
export const Button = styled('button', (props, theme) => ({
|
|
40
44
|
appearance: 'none',
|
|
41
45
|
fontSize: '.9em',
|
|
@@ -49,11 +53,17 @@ export const Button = styled('button', (props, theme) => ({
|
|
|
49
53
|
cursor: 'pointer',
|
|
50
54
|
}))
|
|
51
55
|
|
|
56
|
+
Button.displayName = 'Button'
|
|
57
|
+
|
|
52
58
|
export const QueryKeys = styled('span', {
|
|
53
|
-
display: '
|
|
59
|
+
display: 'flex',
|
|
60
|
+
flexWrap: 'wrap',
|
|
61
|
+
gap: '0.5em',
|
|
54
62
|
fontSize: '0.9em',
|
|
55
63
|
})
|
|
56
64
|
|
|
65
|
+
QueryKeys.displayName = 'QueryKeys'
|
|
66
|
+
|
|
57
67
|
export const QueryKey = styled('span', {
|
|
58
68
|
display: 'inline-flex',
|
|
59
69
|
alignItems: 'center',
|
|
@@ -63,12 +73,16 @@ export const QueryKey = styled('span', {
|
|
|
63
73
|
borderRadius: '.2em',
|
|
64
74
|
})
|
|
65
75
|
|
|
76
|
+
QueryKey.displayName = 'QueryKey'
|
|
77
|
+
|
|
66
78
|
export const Code = styled('code', {
|
|
67
79
|
fontSize: '.9em',
|
|
68
80
|
color: 'inherit',
|
|
69
81
|
background: 'inherit',
|
|
70
82
|
})
|
|
71
83
|
|
|
84
|
+
Code.displayName = 'Code'
|
|
85
|
+
|
|
72
86
|
export const Input = styled('input', (_props, theme) => ({
|
|
73
87
|
backgroundColor: theme.inputBackgroundColor,
|
|
74
88
|
border: 0,
|
|
@@ -79,6 +93,8 @@ export const Input = styled('input', (_props, theme) => ({
|
|
|
79
93
|
padding: '.3em .4em',
|
|
80
94
|
}))
|
|
81
95
|
|
|
96
|
+
Input.displayName = 'Input'
|
|
97
|
+
|
|
82
98
|
export const Select = styled(
|
|
83
99
|
'select',
|
|
84
100
|
(_props, theme) => ({
|
|
@@ -106,3 +122,5 @@ export const Select = styled(
|
|
|
106
122
|
},
|
|
107
123
|
},
|
|
108
124
|
)
|
|
125
|
+
|
|
126
|
+
Select.displayName = 'Select'
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import type { QueryCache } from '@tanstack/react-query'
|
|
3
|
+
import { notifyManager } from '@tanstack/react-query'
|
|
4
|
+
|
|
5
|
+
const useSubscribeToQueryCache = <T>(
|
|
6
|
+
queryCache: QueryCache,
|
|
7
|
+
getSnapshot: () => T,
|
|
8
|
+
skip: boolean = false,
|
|
9
|
+
): T => {
|
|
10
|
+
return React.useSyncExternalStore(
|
|
11
|
+
React.useCallback(
|
|
12
|
+
(onStoreChange) => {
|
|
13
|
+
if (!skip)
|
|
14
|
+
return queryCache.subscribe(notifyManager.batchCalls(onStoreChange))
|
|
15
|
+
return () => {
|
|
16
|
+
return
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
[queryCache, skip],
|
|
20
|
+
),
|
|
21
|
+
getSnapshot,
|
|
22
|
+
getSnapshot,
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default useSubscribeToQueryCache
|