@tanstack/query-devtools 5.74.7 → 5.76.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/{C2Q2AJ2U.js → 2ZEF3XTO.js} +1 -1
- package/build/DevtoolsComponent/{OHEVZFKG.js → 6BZD2SY2.js} +1 -1
- package/build/DevtoolsPanelComponent/{CTUG6TWM.js → 4GTSBKBA.js} +1 -1
- package/build/DevtoolsPanelComponent/{ZXCTK5ZC.js → G73NX4V5.js} +1 -1
- package/build/chunk/{PPK4CBG4.js → U3MG367F.js} +570 -502
- package/build/chunk/{SUJ6RQCA.js → YBOVUDTV.js} +570 -502
- package/build/dev.cjs +573 -505
- package/build/dev.js +2 -2
- package/build/index.cjs +573 -505
- package/build/index.js +2 -2
- package/package.json +2 -2
- package/src/Devtools.tsx +91 -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/2ZEF3XTO.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/4GTSBKBA.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.76.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.76.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,
|
|
@@ -1768,29 +1776,43 @@ const QueryDetails = () => {
|
|
|
1768
1776
|
const color = createMemo(() => getQueryStatusColorByLabel(statusLabel()))
|
|
1769
1777
|
|
|
1770
1778
|
const handleRefetch = () => {
|
|
1779
|
+
sendDevToolsEvent({ type: 'REFETCH', queryHash: activeQuery()?.queryHash })
|
|
1771
1780
|
const promise = activeQuery()?.fetch()
|
|
1772
1781
|
promise?.catch(() => {})
|
|
1773
1782
|
}
|
|
1774
1783
|
|
|
1775
1784
|
const triggerError = (errorType?: DevtoolsErrorType) => {
|
|
1785
|
+
const activeQueryVal = activeQuery()
|
|
1786
|
+
if (!activeQueryVal) return
|
|
1787
|
+
sendDevToolsEvent({
|
|
1788
|
+
type: 'TRIGGER_ERROR',
|
|
1789
|
+
queryHash: activeQueryVal.queryHash,
|
|
1790
|
+
metadata: { error: errorType?.name },
|
|
1791
|
+
})
|
|
1776
1792
|
const error =
|
|
1777
|
-
errorType?.initializer(
|
|
1793
|
+
errorType?.initializer(activeQueryVal) ??
|
|
1778
1794
|
new Error('Unknown error from devtools')
|
|
1779
1795
|
|
|
1780
|
-
const __previousQueryOptions =
|
|
1796
|
+
const __previousQueryOptions = activeQueryVal.options
|
|
1781
1797
|
|
|
1782
|
-
|
|
1798
|
+
activeQueryVal.setState({
|
|
1783
1799
|
status: 'error',
|
|
1784
1800
|
error,
|
|
1785
1801
|
fetchMeta: {
|
|
1786
|
-
...
|
|
1802
|
+
...activeQueryVal.state.fetchMeta,
|
|
1787
1803
|
__previousQueryOptions,
|
|
1788
1804
|
} as any,
|
|
1789
1805
|
} as QueryState<unknown, Error>)
|
|
1790
1806
|
}
|
|
1791
1807
|
|
|
1792
1808
|
const restoreQueryAfterLoadingOrError = () => {
|
|
1793
|
-
const activeQueryVal = activeQuery()
|
|
1809
|
+
const activeQueryVal = activeQuery()
|
|
1810
|
+
if (!activeQueryVal) return
|
|
1811
|
+
|
|
1812
|
+
sendDevToolsEvent({
|
|
1813
|
+
type: 'RESTORE_LOADING',
|
|
1814
|
+
queryHash: activeQueryVal.queryHash,
|
|
1815
|
+
})
|
|
1794
1816
|
const previousState = activeQueryVal.state
|
|
1795
1817
|
const previousOptions = activeQueryVal.state.fetchMeta
|
|
1796
1818
|
? (activeQueryVal.state.fetchMeta as any).__previousQueryOptions
|
|
@@ -1899,7 +1921,13 @@ const QueryDetails = () => {
|
|
|
1899
1921
|
'tsqd-query-details-actions-btn',
|
|
1900
1922
|
'tsqd-query-details-action-invalidate',
|
|
1901
1923
|
)}
|
|
1902
|
-
onClick={() =>
|
|
1924
|
+
onClick={() => {
|
|
1925
|
+
sendDevToolsEvent({
|
|
1926
|
+
type: 'INVALIDATE',
|
|
1927
|
+
queryHash: activeQuery()?.queryHash,
|
|
1928
|
+
})
|
|
1929
|
+
queryClient.invalidateQueries(activeQuery())
|
|
1930
|
+
}}
|
|
1903
1931
|
disabled={queryStatus() === 'pending'}
|
|
1904
1932
|
>
|
|
1905
1933
|
<span
|
|
@@ -1917,7 +1945,13 @@ const QueryDetails = () => {
|
|
|
1917
1945
|
'tsqd-query-details-actions-btn',
|
|
1918
1946
|
'tsqd-query-details-action-reset',
|
|
1919
1947
|
)}
|
|
1920
|
-
onClick={() =>
|
|
1948
|
+
onClick={() => {
|
|
1949
|
+
sendDevToolsEvent({
|
|
1950
|
+
type: 'RESET',
|
|
1951
|
+
queryHash: activeQuery()?.queryHash,
|
|
1952
|
+
})
|
|
1953
|
+
queryClient.resetQueries(activeQuery())
|
|
1954
|
+
}}
|
|
1921
1955
|
disabled={queryStatus() === 'pending'}
|
|
1922
1956
|
>
|
|
1923
1957
|
<span
|
|
@@ -1936,6 +1970,10 @@ const QueryDetails = () => {
|
|
|
1936
1970
|
'tsqd-query-details-action-remove',
|
|
1937
1971
|
)}
|
|
1938
1972
|
onClick={() => {
|
|
1973
|
+
sendDevToolsEvent({
|
|
1974
|
+
type: 'REMOVE',
|
|
1975
|
+
queryHash: activeQuery()?.queryHash,
|
|
1976
|
+
})
|
|
1939
1977
|
queryClient.removeQueries(activeQuery())
|
|
1940
1978
|
setSelectedQueryHash(null)
|
|
1941
1979
|
}}
|
|
@@ -1964,6 +2002,10 @@ const QueryDetails = () => {
|
|
|
1964
2002
|
} else {
|
|
1965
2003
|
const activeQueryVal = activeQuery()
|
|
1966
2004
|
if (!activeQueryVal) return
|
|
2005
|
+
sendDevToolsEvent({
|
|
2006
|
+
type: 'TRIGGER_LOADING',
|
|
2007
|
+
queryHash: activeQueryVal.queryHash,
|
|
2008
|
+
})
|
|
1967
2009
|
const __previousQueryOptions = activeQueryVal.options
|
|
1968
2010
|
// Trigger a fetch in order to trigger suspense as well.
|
|
1969
2011
|
activeQueryVal.fetch({
|
|
@@ -2006,6 +2048,10 @@ const QueryDetails = () => {
|
|
|
2006
2048
|
if (!activeQuery()!.state.error) {
|
|
2007
2049
|
triggerError()
|
|
2008
2050
|
} else {
|
|
2051
|
+
sendDevToolsEvent({
|
|
2052
|
+
type: 'RESTORE_ERROR',
|
|
2053
|
+
queryHash: activeQuery()?.queryHash,
|
|
2054
|
+
})
|
|
2009
2055
|
queryClient.resetQueries(activeQuery())
|
|
2010
2056
|
}
|
|
2011
2057
|
}}
|
|
@@ -2438,6 +2484,37 @@ const createSubscribeToMutationCacheBatcher = <T,>(
|
|
|
2438
2484
|
return value
|
|
2439
2485
|
}
|
|
2440
2486
|
|
|
2487
|
+
type DevToolsActionType =
|
|
2488
|
+
| 'REFETCH'
|
|
2489
|
+
| 'INVALIDATE'
|
|
2490
|
+
| 'RESET'
|
|
2491
|
+
| 'REMOVE'
|
|
2492
|
+
| 'TRIGGER_ERROR'
|
|
2493
|
+
| 'RESTORE_ERROR'
|
|
2494
|
+
| 'TRIGGER_LOADING'
|
|
2495
|
+
| 'RESTORE_LOADING'
|
|
2496
|
+
| 'CLEAR_MUTATION_CACHE'
|
|
2497
|
+
| 'CLEAR_QUERY_CACHE'
|
|
2498
|
+
|
|
2499
|
+
const DEV_TOOLS_EVENT = '@tanstack/query-devtools-event'
|
|
2500
|
+
|
|
2501
|
+
const sendDevToolsEvent = ({
|
|
2502
|
+
type,
|
|
2503
|
+
queryHash,
|
|
2504
|
+
metadata,
|
|
2505
|
+
}: {
|
|
2506
|
+
type: DevToolsActionType
|
|
2507
|
+
queryHash?: string
|
|
2508
|
+
metadata?: Record<string, unknown>
|
|
2509
|
+
}) => {
|
|
2510
|
+
const event = new CustomEvent(DEV_TOOLS_EVENT, {
|
|
2511
|
+
detail: { type, queryHash, metadata },
|
|
2512
|
+
bubbles: true,
|
|
2513
|
+
cancelable: true,
|
|
2514
|
+
})
|
|
2515
|
+
window.dispatchEvent(event)
|
|
2516
|
+
}
|
|
2517
|
+
|
|
2441
2518
|
const stylesFactory = (
|
|
2442
2519
|
theme: 'light' | 'dark',
|
|
2443
2520
|
css: (typeof goober)['css'],
|