()
| 2213 | * @returns The `schedule` function to pass to a registry's `notify`. |
| 2214 | */ |
| 2215 | const createCoalescedSchedule = () => { |
| 2216 | const pendingUpdates = new Map<symbol, () => void>() |
| 2217 | const flush = () => { |
| 2218 | const updates = [...pendingUpdates.values()] |
| 2219 | pendingUpdates.clear() |
| 2220 | batch(() => { |
| 2221 | updates.forEach((update) => update()) |
| 2222 | }) |
| 2223 | } |
| 2224 | onCleanup(() => pendingUpdates.clear()) |
| 2225 | return (update: () => void, id: symbol) => { |
| 2226 | if (!pendingUpdates.size) queueMicrotask(flush) |
| 2227 | pendingUpdates.set(id, update) |
| 2228 | } |
| 2229 | } |
| 2230 | |
| 2231 | const setupQueryCacheSubscription = () => { |
| 2232 | const { queryCacheSubscriptions } = useDevtoolsSubscriptions() |
no test coverage detected