MCPcopy Create free account
hub / github.com/TanStack/query / #notify

Method #notify

packages/query-core/src/queriesObserver.ts:409–431  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

407 }
408
409 #notify(): void {
410 if (this.hasListeners()) {
411 const shouldSkipCombine = this.#shouldSkipCombine()
412 const previousResult = this.#combinedResult
413 const newResult = shouldSkipCombine
414 ? previousResult
415 : this.#combineResult(
416 this.#trackResult(this.#result, this.#observerMatches),
417 this.#options?.combine,
418 this.#observerMatches.map(
419 (match) => match.defaultedQueryOptions.queryHash,
420 ),
421 )
422
423 if (shouldSkipCombine || previousResult !== newResult) {
424 notifyManager.batch(() => {
425 this.listeners.forEach((listener) => {
426 listener(this.#result)
427 })
428 })
429 }
430 }
431 }
432}
433
434type QueryObserverMatch = {

Callers 2

setQueriesMethod · 0.95
#onUpdateMethod · 0.95

Calls 5

#shouldSkipCombineMethod · 0.95
#combineResultMethod · 0.95
#trackResultMethod · 0.95
hasListenersMethod · 0.80
listenerFunction · 0.50

Tested by

no test coverage detected