()
| 2578 | >() |
| 2579 | |
| 2580 | const setupQueryCacheSubscription = () => { |
| 2581 | const queryCache = createMemo(() => { |
| 2582 | const client = useQueryDevtoolsContext().client |
| 2583 | return client.getQueryCache() |
| 2584 | }) |
| 2585 | |
| 2586 | const unsubscribe = queryCache().subscribe((q) => { |
| 2587 | batch(() => { |
| 2588 | for (const [callback, value] of queryCacheMap.entries()) { |
| 2589 | if (!value.shouldUpdate(q)) continue |
| 2590 | value.setter(callback(queryCache)) |
| 2591 | } |
| 2592 | }) |
| 2593 | }) |
| 2594 | |
| 2595 | onCleanup(() => { |
| 2596 | queryCacheMap.clear() |
| 2597 | unsubscribe() |
| 2598 | }) |
| 2599 | |
| 2600 | return unsubscribe |
| 2601 | } |
| 2602 | |
| 2603 | const createSubscribeToQueryCacheBatcher = <T,>( |
| 2604 | callback: (queryCache: Accessor<QueryCache>) => Exclude<T, Function>, |
no test coverage detected