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

Method cancel

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

* Cancels the query's currently in-flight fetch, if any. * - Returns a promise that resolves once the cancellation has settled. * - If no fetch is in progress, resolves immediately. * @param options - Set `revert` to restore the state from before the fetch started, and `silent` * to supp

(options?: CancelOptions)

Source from the content-addressed store, hash-verified

427 * ```
428 */
429 cancel(options?: CancelOptions): Promise<void> {
430 const promise = this.#retryer?.promise
431 this.#retryer?.cancel(options)
432 return promise ? promise.then(noop).catch(noop) : Promise.resolve()
433 }
434
435 /**
436 * Clears the query's garbage collection timeout and silently cancels any

Callers 8

destroyMethod · 0.95
fetchMethod · 0.95
cancelQueriesMethod · 0.80
removeObserverMethod · 0.80
retryer.test.tsxFile · 0.80
query.test.tsxFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected