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

Method removeObserver

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

* Unsubscribes an observer from the mutation. * @internal * @param observer - The observer to remove. Schedules garbage collection if the mutation * is still in the cache.

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

Source from the content-addressed store, hash-verified

216 * is still in the cache.
217 */
218 removeObserver(observer: MutationObserver<any, any, any, any>): void {
219 this.#observers = this.#observers.filter((x) => x !== observer)
220
221 if (this.#mutationCache.has(this)) {
222 this.scheduleGc()
223 }
224
225 this.#mutationCache.notify({
226 type: 'observerRemoved',
227 mutation: this,
228 observer,
229 })
230 }
231
232 protected override optionalRemove() {
233 if (!this.#observers.length) {

Callers

nothing calls this directly

Calls 2

hasMethod · 0.80
notifyMethod · 0.45

Tested by

no test coverage detected