MCPcopy Create free account
hub / github.com/TanStack/query / setState

Method setState

packages/query-core/src/query.ts:334–336  ·  view source on GitHub ↗

* Merges the given partial state directly into this query's state, notifying observers. Used * by persistence and broadcast plugins to restore a state snapshot, and by devtools to let a * user manually trigger a loading/error state or edit the cached data.

(state: Partial<QueryState<TData, TError>>)

Source from the content-addressed store, hash-verified

332 * user manually trigger a loading/error state or edit the cached data.
333 */
334 setState(state: Partial<QueryState<TData, TError>>): void {
335 this.#dispatch({ type: 'setState', state })
336 }
337
338 /**
339 * Cancels the query's currently in-flight fetch, if any.

Callers 15

setOptionsMethod · 0.95
resetMethod · 0.95
fetchMethod · 0.95
setupDevtoolsFunction · 0.80
triggerErrorFunction · 0.80
QueryDetailsFunction · 0.80
buildQueryFunction · 0.80
utils.test.tsFile · 0.80
makeStateFunction · 0.80
Devtools.test.tsxFile · 0.80
resetErrorBoundaryMethod · 0.80

Calls 1

#dispatchMethod · 0.95

Tested by 4

buildQueryFunction · 0.64
makeStateFunction · 0.64
resetErrorBoundaryMethod · 0.64
componentDidUpdateMethod · 0.64