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

Function setupQueryCacheSubscription

packages/query-devtools/src/Devtools.tsx:2712–2728  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2710}
2711
2712const setupQueryCacheSubscription = () => {
2713 const { queryCacheSubscriptions } = useDevtoolsSubscriptions()
2714 const queryCache = createMemo(() => {
2715 const client = useQueryDevtoolsContext().client
2716 return client.getQueryCache()
2717 })
2718
2719 createEffect(() => {
2720 const cache = queryCache()
2721 const unsubscribe = cache.subscribe((event) => {
2722 batch(() => {
2723 queryCacheSubscriptions.notify(() => cache, event)
2724 })
2725 })
2726 onCleanup(unsubscribe)
2727 })
2728}
2729
2730const createSubscribeToQueryCacheBatcher = <T,>(
2731 callback: (

Callers 1

ContentViewFunction · 0.85

Calls 5

useDevtoolsSubscriptionsFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
getQueryCacheMethod · 0.80
subscribeMethod · 0.45
notifyMethod · 0.45

Tested by

no test coverage detected