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

Method onSubscribe

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

Source from the content-addressed store, hash-verified

108 }
109
110 protected onSubscribe(): void {
111 if (this.listeners.size === 1) {
112 this.#currentQuery.addObserver(this)
113
114 if (shouldFetchOnMount(this.#currentQuery, this.options)) {
115 this.#executeFetch()
116 } else {
117 this.updateResult()
118 }
119
120 this.#updateTimers()
121 }
122 }
123
124 protected onUnsubscribe(): void {
125 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