()
| 2253 | } |
| 2254 | |
| 2255 | const setupMutationCacheSubscription = () => { |
| 2256 | const { mutationCacheSubscriptions } = useDevtoolsSubscriptions() |
| 2257 | const mutationCache = createMemo(() => { |
| 2258 | const client = useQueryDevtoolsContext().client |
| 2259 | return client.getMutationCache() |
| 2260 | }) |
| 2261 | |
| 2262 | createEffect(() => { |
| 2263 | const cache = mutationCache() |
| 2264 | let active = true |
| 2265 | const unsubscribe = cache.subscribe((event) => { |
| 2266 | mutationCacheSubscriptions.notify( |
| 2267 | () => cache, |
| 2268 | event, |
| 2269 | (update) => { |
| 2270 | queueMicrotask(() => { |
| 2271 | if (active) update() |
| 2272 | }) |
| 2273 | }, |
| 2274 | ) |
| 2275 | }) |
| 2276 | onCleanup(() => { |
| 2277 | active = false |
| 2278 | unsubscribe() |
| 2279 | }) |
| 2280 | }) |
| 2281 | } |
| 2282 | |
| 2283 | const createSubscribeToMutationCacheBatcher = <T,>( |
| 2284 | callback: ( |
no test coverage detected