@tanstack/query-devtools 5.74.7 → 5.80.0
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/DevtoolsComponent/{OHEVZFKG.js → HH7B3BHX.js} +1 -1
- package/build/DevtoolsComponent/{C2Q2AJ2U.js → I3HPI4QX.js} +1 -1
- package/build/DevtoolsPanelComponent/{CTUG6TWM.js → CXEL7IU7.js} +1 -1
- package/build/DevtoolsPanelComponent/{ZXCTK5ZC.js → JZI2RDCT.js} +1 -1
- package/build/chunk/{PPK4CBG4.js → HASRA6WW.js} +593 -502
- package/build/chunk/{SUJ6RQCA.js → L7Z3HDK6.js} +593 -502
- package/build/dev.cjs +596 -505
- package/build/dev.js +2 -2
- package/build/index.cjs +596 -505
- package/build/index.js +2 -2
- package/package.json +2 -2
- package/src/Devtools.tsx +116 -14
package/build/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var TanstackQueryDevtools = class {
|
|
|
69
69
|
if (this.#Component) {
|
|
70
70
|
Devtools = this.#Component;
|
|
71
71
|
} else {
|
|
72
|
-
Devtools = lazy(() => import('./DevtoolsComponent/
|
|
72
|
+
Devtools = lazy(() => import('./DevtoolsComponent/I3HPI4QX.js'));
|
|
73
73
|
this.#Component = Devtools;
|
|
74
74
|
}
|
|
75
75
|
setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
|
|
@@ -192,7 +192,7 @@ var TanstackQueryDevtoolsPanel = class {
|
|
|
192
192
|
if (this.#Component) {
|
|
193
193
|
Devtools = this.#Component;
|
|
194
194
|
} else {
|
|
195
|
-
Devtools = lazy(() => import('./DevtoolsPanelComponent/
|
|
195
|
+
Devtools = lazy(() => import('./DevtoolsPanelComponent/CXEL7IU7.js'));
|
|
196
196
|
this.#Component = Devtools;
|
|
197
197
|
}
|
|
198
198
|
setupStyleSheet(this.#styleNonce, this.#shadowDOMTarget);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/query-devtools",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.80.0",
|
|
4
4
|
"description": "Developer tools to interact with and visualize the TanStack Query cache",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"superjson": "^2.2.1",
|
|
58
58
|
"tsup-preset-solid": "^2.2.0",
|
|
59
59
|
"vite-plugin-solid": "^2.11.6",
|
|
60
|
-
"@tanstack/query-core": "5.
|
|
60
|
+
"@tanstack/query-core": "5.80.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {}
|
|
63
63
|
}
|
package/src/Devtools.tsx
CHANGED
|
@@ -120,6 +120,18 @@ export const Devtools: Component<DevtoolsPanelProps> = (props) => {
|
|
|
120
120
|
const styles = createMemo(() => {
|
|
121
121
|
return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
|
|
122
122
|
})
|
|
123
|
+
const onlineManager = createMemo(
|
|
124
|
+
() => useQueryDevtoolsContext().onlineManager,
|
|
125
|
+
)
|
|
126
|
+
onMount(() => {
|
|
127
|
+
const unsubscribe = onlineManager().subscribe((online) => {
|
|
128
|
+
setOffline(!online)
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
onCleanup(() => {
|
|
132
|
+
unsubscribe()
|
|
133
|
+
})
|
|
134
|
+
})
|
|
123
135
|
|
|
124
136
|
const pip = usePiPWindow()
|
|
125
137
|
|
|
@@ -922,8 +934,10 @@ export const ContentView: Component<ContentViewProps> = (props) => {
|
|
|
922
934
|
<button
|
|
923
935
|
onClick={() => {
|
|
924
936
|
if (selectedView() === 'queries') {
|
|
937
|
+
sendDevToolsEvent({ type: 'CLEAR_QUERY_CACHE' })
|
|
925
938
|
query_cache().clear()
|
|
926
939
|
} else {
|
|
940
|
+
sendDevToolsEvent({ type: 'CLEAR_MUTATION_CACHE' })
|
|
927
941
|
mutation_cache().clear()
|
|
928
942
|
}
|
|
929
943
|
}}
|
|
@@ -939,13 +953,7 @@ export const ContentView: Component<ContentViewProps> = (props) => {
|
|
|
939
953
|
</button>
|
|
940
954
|
<button
|
|
941
955
|
onClick={() => {
|
|
942
|
-
|
|
943
|
-
onlineManager().setOnline(true)
|
|
944
|
-
setOffline(false)
|
|
945
|
-
} else {
|
|
946
|
-
onlineManager().setOnline(false)
|
|
947
|
-
setOffline(true)
|
|
948
|
-
}
|
|
956
|
+
onlineManager().setOnline(!onlineManager().isOnline())
|
|
949
957
|
}}
|
|
950
958
|
class={cx(
|
|
951
959
|
styles().actionsBtn,
|
|
@@ -1255,6 +1263,17 @@ const QueryRow: Component<{ query: Query }> = (props) => {
|
|
|
1255
1263
|
(e) => e.query.queryHash === props.query.queryHash,
|
|
1256
1264
|
)
|
|
1257
1265
|
|
|
1266
|
+
const isStatic = createSubscribeToQueryCacheBatcher(
|
|
1267
|
+
(queryCache) =>
|
|
1268
|
+
queryCache()
|
|
1269
|
+
.find({
|
|
1270
|
+
queryKey: props.query.queryKey,
|
|
1271
|
+
})
|
|
1272
|
+
?.isStatic() ?? false,
|
|
1273
|
+
true,
|
|
1274
|
+
(e) => e.query.queryHash === props.query.queryHash,
|
|
1275
|
+
)
|
|
1276
|
+
|
|
1258
1277
|
const isStale = createSubscribeToQueryCacheBatcher(
|
|
1259
1278
|
(queryCache) =>
|
|
1260
1279
|
queryCache()
|
|
@@ -1329,6 +1348,9 @@ const QueryRow: Component<{ query: Query }> = (props) => {
|
|
|
1329
1348
|
<Show when={isDisabled()}>
|
|
1330
1349
|
<div class="tsqd-query-disabled-indicator">disabled</div>
|
|
1331
1350
|
</Show>
|
|
1351
|
+
<Show when={isStatic()}>
|
|
1352
|
+
<div class="tsqd-query-static-indicator">static</div>
|
|
1353
|
+
</Show>
|
|
1332
1354
|
</button>
|
|
1333
1355
|
</Show>
|
|
1334
1356
|
)
|
|
@@ -1768,29 +1790,43 @@ const QueryDetails = () => {
|
|
|
1768
1790
|
const color = createMemo(() => getQueryStatusColorByLabel(statusLabel()))
|
|
1769
1791
|
|
|
1770
1792
|
const handleRefetch = () => {
|
|
1793
|
+
sendDevToolsEvent({ type: 'REFETCH', queryHash: activeQuery()?.queryHash })
|
|
1771
1794
|
const promise = activeQuery()?.fetch()
|
|
1772
1795
|
promise?.catch(() => {})
|
|
1773
1796
|
}
|
|
1774
1797
|
|
|
1775
1798
|
const triggerError = (errorType?: DevtoolsErrorType) => {
|
|
1799
|
+
const activeQueryVal = activeQuery()
|
|
1800
|
+
if (!activeQueryVal) return
|
|
1801
|
+
sendDevToolsEvent({
|
|
1802
|
+
type: 'TRIGGER_ERROR',
|
|
1803
|
+
queryHash: activeQueryVal.queryHash,
|
|
1804
|
+
metadata: { error: errorType?.name },
|
|
1805
|
+
})
|
|
1776
1806
|
const error =
|
|
1777
|
-
errorType?.initializer(
|
|
1807
|
+
errorType?.initializer(activeQueryVal) ??
|
|
1778
1808
|
new Error('Unknown error from devtools')
|
|
1779
1809
|
|
|
1780
|
-
const __previousQueryOptions =
|
|
1810
|
+
const __previousQueryOptions = activeQueryVal.options
|
|
1781
1811
|
|
|
1782
|
-
|
|
1812
|
+
activeQueryVal.setState({
|
|
1783
1813
|
status: 'error',
|
|
1784
1814
|
error,
|
|
1785
1815
|
fetchMeta: {
|
|
1786
|
-
...
|
|
1816
|
+
...activeQueryVal.state.fetchMeta,
|
|
1787
1817
|
__previousQueryOptions,
|
|
1788
1818
|
} as any,
|
|
1789
1819
|
} as QueryState<unknown, Error>)
|
|
1790
1820
|
}
|
|
1791
1821
|
|
|
1792
1822
|
const restoreQueryAfterLoadingOrError = () => {
|
|
1793
|
-
const activeQueryVal = activeQuery()
|
|
1823
|
+
const activeQueryVal = activeQuery()
|
|
1824
|
+
if (!activeQueryVal) return
|
|
1825
|
+
|
|
1826
|
+
sendDevToolsEvent({
|
|
1827
|
+
type: 'RESTORE_LOADING',
|
|
1828
|
+
queryHash: activeQueryVal.queryHash,
|
|
1829
|
+
})
|
|
1794
1830
|
const previousState = activeQueryVal.state
|
|
1795
1831
|
const previousOptions = activeQueryVal.state.fetchMeta
|
|
1796
1832
|
? (activeQueryVal.state.fetchMeta as any).__previousQueryOptions
|
|
@@ -1899,7 +1935,13 @@ const QueryDetails = () => {
|
|
|
1899
1935
|
'tsqd-query-details-actions-btn',
|
|
1900
1936
|
'tsqd-query-details-action-invalidate',
|
|
1901
1937
|
)}
|
|
1902
|
-
onClick={() =>
|
|
1938
|
+
onClick={() => {
|
|
1939
|
+
sendDevToolsEvent({
|
|
1940
|
+
type: 'INVALIDATE',
|
|
1941
|
+
queryHash: activeQuery()?.queryHash,
|
|
1942
|
+
})
|
|
1943
|
+
queryClient.invalidateQueries(activeQuery())
|
|
1944
|
+
}}
|
|
1903
1945
|
disabled={queryStatus() === 'pending'}
|
|
1904
1946
|
>
|
|
1905
1947
|
<span
|
|
@@ -1917,7 +1959,13 @@ const QueryDetails = () => {
|
|
|
1917
1959
|
'tsqd-query-details-actions-btn',
|
|
1918
1960
|
'tsqd-query-details-action-reset',
|
|
1919
1961
|
)}
|
|
1920
|
-
onClick={() =>
|
|
1962
|
+
onClick={() => {
|
|
1963
|
+
sendDevToolsEvent({
|
|
1964
|
+
type: 'RESET',
|
|
1965
|
+
queryHash: activeQuery()?.queryHash,
|
|
1966
|
+
})
|
|
1967
|
+
queryClient.resetQueries(activeQuery())
|
|
1968
|
+
}}
|
|
1921
1969
|
disabled={queryStatus() === 'pending'}
|
|
1922
1970
|
>
|
|
1923
1971
|
<span
|
|
@@ -1936,6 +1984,10 @@ const QueryDetails = () => {
|
|
|
1936
1984
|
'tsqd-query-details-action-remove',
|
|
1937
1985
|
)}
|
|
1938
1986
|
onClick={() => {
|
|
1987
|
+
sendDevToolsEvent({
|
|
1988
|
+
type: 'REMOVE',
|
|
1989
|
+
queryHash: activeQuery()?.queryHash,
|
|
1990
|
+
})
|
|
1939
1991
|
queryClient.removeQueries(activeQuery())
|
|
1940
1992
|
setSelectedQueryHash(null)
|
|
1941
1993
|
}}
|
|
@@ -1964,6 +2016,10 @@ const QueryDetails = () => {
|
|
|
1964
2016
|
} else {
|
|
1965
2017
|
const activeQueryVal = activeQuery()
|
|
1966
2018
|
if (!activeQueryVal) return
|
|
2019
|
+
sendDevToolsEvent({
|
|
2020
|
+
type: 'TRIGGER_LOADING',
|
|
2021
|
+
queryHash: activeQueryVal.queryHash,
|
|
2022
|
+
})
|
|
1967
2023
|
const __previousQueryOptions = activeQueryVal.options
|
|
1968
2024
|
// Trigger a fetch in order to trigger suspense as well.
|
|
1969
2025
|
activeQueryVal.fetch({
|
|
@@ -2006,6 +2062,10 @@ const QueryDetails = () => {
|
|
|
2006
2062
|
if (!activeQuery()!.state.error) {
|
|
2007
2063
|
triggerError()
|
|
2008
2064
|
} else {
|
|
2065
|
+
sendDevToolsEvent({
|
|
2066
|
+
type: 'RESTORE_ERROR',
|
|
2067
|
+
queryHash: activeQuery()?.queryHash,
|
|
2068
|
+
})
|
|
2009
2069
|
queryClient.resetQueries(activeQuery())
|
|
2010
2070
|
}
|
|
2011
2071
|
}}
|
|
@@ -2438,6 +2498,37 @@ const createSubscribeToMutationCacheBatcher = <T,>(
|
|
|
2438
2498
|
return value
|
|
2439
2499
|
}
|
|
2440
2500
|
|
|
2501
|
+
type DevToolsActionType =
|
|
2502
|
+
| 'REFETCH'
|
|
2503
|
+
| 'INVALIDATE'
|
|
2504
|
+
| 'RESET'
|
|
2505
|
+
| 'REMOVE'
|
|
2506
|
+
| 'TRIGGER_ERROR'
|
|
2507
|
+
| 'RESTORE_ERROR'
|
|
2508
|
+
| 'TRIGGER_LOADING'
|
|
2509
|
+
| 'RESTORE_LOADING'
|
|
2510
|
+
| 'CLEAR_MUTATION_CACHE'
|
|
2511
|
+
| 'CLEAR_QUERY_CACHE'
|
|
2512
|
+
|
|
2513
|
+
const DEV_TOOLS_EVENT = '@tanstack/query-devtools-event'
|
|
2514
|
+
|
|
2515
|
+
const sendDevToolsEvent = ({
|
|
2516
|
+
type,
|
|
2517
|
+
queryHash,
|
|
2518
|
+
metadata,
|
|
2519
|
+
}: {
|
|
2520
|
+
type: DevToolsActionType
|
|
2521
|
+
queryHash?: string
|
|
2522
|
+
metadata?: Record<string, unknown>
|
|
2523
|
+
}) => {
|
|
2524
|
+
const event = new CustomEvent(DEV_TOOLS_EVENT, {
|
|
2525
|
+
detail: { type, queryHash, metadata },
|
|
2526
|
+
bubbles: true,
|
|
2527
|
+
cancelable: true,
|
|
2528
|
+
})
|
|
2529
|
+
window.dispatchEvent(event)
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2441
2532
|
const stylesFactory = (
|
|
2442
2533
|
theme: 'light' | 'dark',
|
|
2443
2534
|
css: (typeof goober)['css'],
|
|
@@ -3103,6 +3194,17 @@ const stylesFactory = (
|
|
|
3103
3194
|
border-bottom: 1px solid ${t(colors.gray[300], colors.darkGray[400])};
|
|
3104
3195
|
font-size: ${font.size.xs};
|
|
3105
3196
|
}
|
|
3197
|
+
|
|
3198
|
+
& .tsqd-query-static-indicator {
|
|
3199
|
+
align-self: stretch;
|
|
3200
|
+
display: flex;
|
|
3201
|
+
align-items: center;
|
|
3202
|
+
padding: 0 ${tokens.size[2]};
|
|
3203
|
+
color: ${t(colors.teal[800], colors.teal[300])};
|
|
3204
|
+
background-color: ${t(colors.teal[100], colors.teal[900])};
|
|
3205
|
+
border-bottom: 1px solid ${t(colors.teal[300], colors.teal[700])};
|
|
3206
|
+
font-size: ${font.size.xs};
|
|
3207
|
+
}
|
|
3106
3208
|
`,
|
|
3107
3209
|
selectedQueryRow: css`
|
|
3108
3210
|
background-color: ${t(colors.gray[200], colors.darkGray[500])};
|