MCPcopy Create free account
hub / github.com/SvelteStack/svelte-query / notify

Method notify

src/queryCore/core/queryObserver.ts:731–756  ·  view source on GitHub ↗
(notifyOptions: NotifyOptions)

Source from the content-addressed store, hash-verified

729 }
730
731 private notify(notifyOptions: NotifyOptions): void {
732 notifyManager.batch(() => {
733 // First trigger the configuration callbacks
734 if (notifyOptions.onSuccess) {
735 this.options.onSuccess?.(this.currentResult.data!)
736 this.options.onSettled?.(this.currentResult.data!, null)
737 } else if (notifyOptions.onError) {
738 this.options.onError?.(this.currentResult.error!)
739 this.options.onSettled?.(undefined, this.currentResult.error!)
740 }
741
742 // Then trigger the listeners
743 if (notifyOptions.listeners) {
744 this.listeners.forEach(listener => {
745 listener(this.currentResult)
746 })
747 }
748
749 // Then the cache listeners
750 if (notifyOptions.cache) {
751 this.client
752 .getQueryCache()
753 .notify({ query: this.currentQuery, type: 'observerResultsUpdated' })
754 }
755 })
756 }
757}
758
759function shouldLoadOnMount(

Callers 1

updateResultMethod · 0.95

Calls 2

batchMethod · 0.80
getQueryCacheMethod · 0.80

Tested by

no test coverage detected