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

Method updateResult

src/queryCore/core/queryObserver.ts:660–685  ·  view source on GitHub ↗
(notifyOptions?: NotifyOptions)

Source from the content-addressed store, hash-verified

658 }
659
660 updateResult(notifyOptions?: NotifyOptions): void {
661 const prevResult = this.currentResult as
662 | QueryObserverResult<TData, TError>
663 | undefined
664
665 this.currentResult = this.createResult(this.currentQuery, this.options)
666 this.currentResultState = this.currentQuery.state
667 this.currentResultOptions = this.options
668
669 // Only notify if something has changed
670 if (shallowEqualObjects(this.currentResult, prevResult)) {
671 return
672 }
673
674 // Determine which callbacks to trigger
675 const defaultNotifyOptions: NotifyOptions = { cache: true }
676
677 if (
678 notifyOptions?.listeners !== false &&
679 this.shouldNotifyListeners(this.currentResult, prevResult)
680 ) {
681 defaultNotifyOptions.listeners = true
682 }
683
684 this.notify({ ...defaultNotifyOptions, ...notifyOptions })
685 }
686
687 private updateQuery(): void {
688 const query = this.client

Callers 6

setOptionsMethod · 0.95
fetchMethod · 0.95
updateStaleTimeoutMethod · 0.95
onQueryUpdateMethod · 0.95
useQueryFunction · 0.95
useInfiniteQueryFunction · 0.45

Calls 4

createResultMethod · 0.95
shouldNotifyListenersMethod · 0.95
notifyMethod · 0.95
shallowEqualObjectsFunction · 0.90

Tested by

no test coverage detected