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

Method cancel

packages/query-core/src/query.ts:348–352  ·  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. * * @example * ```ts * await query.cancel() * ```

(options?: CancelOptions)

Source from the content-addressed store, hash-verified

346 * ```
347 */
348 cancel(options?: CancelOptions): Promise<void> {
349 const promise = this.#retryer?.promise
350 this.#retryer?.cancel(options)
351 return promise ? promise.then(noop).catch(noop) : Promise.resolve()
352 }
353
354 /**
355 * 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