MCPcopy
hub / github.com/TanStack/query / addObserver

Method addObserver

packages/query-core/src/mutation.ts:128–141  ·  view source on GitHub ↗
(observer: MutationObserver<any, any, any, any>)

Source from the content-addressed store, hash-verified

126 }
127
128 addObserver(observer: MutationObserver<any, any, any, any>): void {
129 if (!this.#observers.includes(observer)) {
130 this.#observers.push(observer)
131
132 // Stop the mutation from being garbage collected
133 this.clearGcTimeout()
134
135 this.#mutationCache.notify({
136 type: 'observerAdded',
137 mutation: this,
138 observer,
139 })
140 }
141 }
142
143 removeObserver(observer: MutationObserver<any, any, any, any>): void {
144 this.#observers = this.#observers.filter((x) => x !== observer)

Callers

nothing calls this directly

Calls 1

notifyMethod · 0.45

Tested by

no test coverage detected