MCPcopy
hub / github.com/TanStack/query / restoreQueryAfterLoadingOrError

Function restoreQueryAfterLoadingOrError

packages/query-devtools/src/Devtools.tsx:1905–1928  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1903 }
1904
1905 const restoreQueryAfterLoadingOrError = () => {
1906 const activeQueryVal = activeQuery()
1907 if (!activeQueryVal) return
1908
1909 sendDevToolsEvent({
1910 type: 'RESTORE_LOADING',
1911 queryHash: activeQueryVal.queryHash,
1912 })
1913 const previousState = activeQueryVal.state
1914 const previousOptions = activeQueryVal.state.fetchMeta
1915 ? (activeQueryVal.state.fetchMeta as any).__previousQueryOptions
1916 : null
1917
1918 activeQueryVal.cancel({ silent: true })
1919 activeQueryVal.setState({
1920 ...previousState,
1921 fetchStatus: 'idle',
1922 fetchMeta: null,
1923 })
1924
1925 if (previousOptions) {
1926 activeQueryVal.fetch(previousOptions)
1927 }
1928 }
1929
1930 createEffect(() => {
1931 if (statusLabel() !== 'fetching') {

Callers 1

QueryDetailsFunction · 0.85

Calls 4

sendDevToolsEventFunction · 0.85
cancelMethod · 0.80
setStateMethod · 0.80
fetchMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…