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

Method mount

packages/query-core/src/queryClient.ts:104–120  ·  view source on GitHub ↗

* Called by a framework adapter's `QueryClientProvider`-equivalent when it mounts, to start * listening for focus/online events and resume paused mutations. Ref-counted via an internal * mount count, so nested or multiple providers sharing the same `QueryClient` don't tear down * the shared

()

Source from the content-addressed store, hash-verified

102 * the shared listeners until the last one unmounts.
103 */
104 mount(): void {
105 this.#mountCount++
106 if (this.#mountCount !== 1) return
107
108 this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
109 if (focused) {
110 await this.resumePausedMutations()
111 this.#queryCache.onFocus()
112 }
113 })
114 this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
115 if (online) {
116 await this.resumePausedMutations()
117 this.#queryCache.onOnline()
118 }
119 })
120 }
121
122 /**
123 * The inverse of {@link QueryClient#mount} — called by a framework adapter's

Callers 15

PreactQueryDevtoolsFunction · 0.45
PreactQueryDevtoolsPanelFunction · 0.45
mountClientMethod · 0.45
vueQueryPlugin.tsFile · 0.45
QueryClientProviderFunction · 0.45
provideQueryClientFunction · 0.45
injectDevtoolsPanelFunction · 0.45
withDevtoolsFunction · 0.45
QueryClientProviderFunction · 0.45
ReactQueryDevtoolsPanelFunction · 0.45
ReactQueryDevtoolsFunction · 0.45
QueryClientProviderFunction · 0.45

Calls 4

resumePausedMutationsMethod · 0.95
subscribeMethod · 0.45
onFocusMethod · 0.45
onOnlineMethod · 0.45

Tested by

no test coverage detected