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

Method onSubscribe

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

Source from the content-addressed store, hash-verified

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