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

Method updateQuery

src/queryCore/core/queryObserver.ts:687–713  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

685 }
686
687 private updateQuery(): void {
688 const query = this.client
689 .getQueryCache()
690 .build(
691 this.client,
692 this.options as unknown as QueryOptions<
693 TQueryFnData,
694 TError,
695 TQueryData,
696 TQueryKey
697 >
698 )
699
700 if (query === this.currentQuery) {
701 return
702 }
703
704 const prevQuery = this.currentQuery
705 this.currentQuery = query
706 this.currentQueryInitialState = query.state
707 this.previousQueryResult = this.currentResult
708
709 if (this.hasListeners()) {
710 prevQuery?.removeObserver(this)
711 query.addObserver(this)
712 }
713 }
714
715 onQueryUpdate(action: Action<TData, TError>): void {
716 const notifyOptions: NotifyOptions = {}

Callers 2

setOptionsMethod · 0.95
executeFetchMethod · 0.95

Calls 5

getQueryCacheMethod · 0.80
hasListenersMethod · 0.80
buildMethod · 0.45
removeObserverMethod · 0.45
addObserverMethod · 0.45

Tested by

no test coverage detected