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

Method reset

packages/query-core/src/mutationObserver.ts:188–195  ·  view source on GitHub ↗

* Detaches the observer from the mutation it is currently observing (if * any) and resets the observed result back to its default, `idle` state. * * This does not cancel an in-flight mutation; the mutation itself keeps * running to completion and its own callbacks still fire, but this

()

Source from the content-addressed store, hash-verified

186 * ```
187 */
188 reset(): void {
189 // reset needs to remove the observer from the mutation because there is no way to "get it back"
190 // another mutate call will yield a new mutation!
191 this.#currentMutation?.removeObserver(this)
192 this.#currentMutation = undefined
193 this.#updateResult()
194 this.#notify()
195 }
196
197 /**
198 * Builds a new `Mutation` in the `MutationCache` using the observer's

Callers 1

setOptionsMethod · 0.95

Calls 3

#updateResultMethod · 0.95
#notifyMethod · 0.95
removeObserverMethod · 0.45

Tested by

no test coverage detected