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

Method mount

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

101 * the shared listeners until the last one unmounts.
102 */
103 mount(): void {
104 this.#mountCount++
105 if (this.#mountCount !== 1) return
106
107 this.#unsubscribeFocus = focusManager.subscribe(async (focused) => {
108 if (focused) {
109 await this.resumePausedMutations()
110 this.#queryCache.onFocus()
111 }
112 })
113 this.#unsubscribeOnline = onlineManager.subscribe(async (online) => {
114 if (online) {
115 await this.resumePausedMutations()
116 this.#queryCache.onOnline()
117 }
118 })
119 }
120
121 /**
122 * 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