MCPcopy Index your code
hub / github.com/TanStack/query / onSubscribe

Method onSubscribe

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

Source from the content-addressed store, hash-verified

94 }
95
96 protected onSubscribe(): void {
97 if (this.listeners.size === 1) {
98 this.#currentQuery.addObserver(this)
99
100 if (shouldFetchOnMount(this.#currentQuery, this.options)) {
101 this.#executeFetch()
102 } else {
103 this.updateResult()
104 }
105
106 this.#updateTimers()
107 }
108 }
109
110 protected onUnsubscribe(): void {
111 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