* 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
()
| 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 |
no test coverage detected