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

Method setState

packages/query-core/src/query.ts:413–415  ·  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. * @param state - The partial state

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

Source from the content-addressed store, hash-verified

411 * @param state - The partial state to merge into the query's state.
412 */
413 setState(state: Partial<QueryState<TData, TError>>): void {
414 this.#dispatch({ type: 'setState', state })
415 }
416
417 /**
418 * 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