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

Method removeObserver

packages/query-core/src/mutation.ts:217–227  ·  view source on GitHub ↗

* Unsubscribes an observer from the mutation. * @internal * @param observer - The observer to remove. Garbage collection is scheduled afterwards.

(observer: MutationObserver<any, any, any, any>)

Source from the content-addressed store, hash-verified

215 * @param observer - The observer to remove. Garbage collection is scheduled afterwards.
216 */
217 removeObserver(observer: MutationObserver<any, any, any, any>): void {
218 this.#observers = this.#observers.filter((x) => x !== observer)
219
220 this.scheduleGc()
221
222 this.#mutationCache.notify({
223 type: 'observerRemoved',
224 mutation: this,
225 observer,
226 })
227 }
228
229 protected override optionalRemove() {
230 if (!this.#observers.length) {

Callers

nothing calls this directly

Calls 1

notifyMethod · 0.45

Tested by

no test coverage detected