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

Method mount

packages/query-core/src/queryClient.ts:106–122  ·  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

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

Callers 15

mountFunction · 0.45
injectDevtoolsPanelFunction · 0.45
PreactQueryDevtoolsFunction · 0.45
PreactQueryDevtoolsPanelFunction · 0.45
mountClientMethod · 0.45
vueQueryPlugin.tsFile · 0.45
QueryClientProviderFunction · 0.45
QueryClientProviderFunction · 0.45
renderDevtoolsFunction · 0.45
client.test.tsFile · 0.45
configureQueryClientFunction · 0.45
ReactQueryDevtoolsPanelFunction · 0.45

Calls 4

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

Tested by 1

renderDevtoolsFunction · 0.36