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

Method reset

packages/query-core/src/mutationObserver.ts:180–187  ·  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

178 * @see {@link MutationObserver#mutate}
179 */
180 reset(): void {
181 // reset needs to remove the observer from the mutation because there is no way to "get it back"
182 // another mutate call will yield a new mutation!
183 this.#currentMutation?.removeObserver(this)
184 this.#currentMutation = undefined
185 this.#updateResult()
186 this.#notify()
187 }
188
189 /**
190 * 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