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

Method onSubscribe

packages/query-core/src/queryObserver.ts:95–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93 }
94
95 protected onSubscribe(): void {
96 if (this.listeners.size === 1) {
97 this.#currentQuery.addObserver(this)
98
99 if (shouldFetchOnMount(this.#currentQuery, this.options)) {
100 this.#executeFetch()
101 } else {
102 this.updateResult()
103 }
104
105 this.#updateTimers()
106 }
107 }
108
109 protected onUnsubscribe(): void {
110 if (!this.hasListeners()) {

Callers

nothing calls this directly

Calls 5

#executeFetchMethod · 0.95
updateResultMethod · 0.95
#updateTimersMethod · 0.95
shouldFetchOnMountFunction · 0.85
addObserverMethod · 0.45

Tested by

no test coverage detected