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

Function setupQueryCacheSubscription

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

Source from the content-addressed store, hash-verified

2207}
2208
2209const setupQueryCacheSubscription = () => {
2210 const { queryCacheSubscriptions } = useDevtoolsSubscriptions()
2211 const queryCache = createMemo(() => {
2212 const client = useQueryDevtoolsContext().client
2213 return client.getQueryCache()
2214 })
2215
2216 createEffect(() => {
2217 const cache = queryCache()
2218 const unsubscribe = cache.subscribe((event) => {
2219 batch(() => {
2220 queryCacheSubscriptions.notify(() => cache, event)
2221 })
2222 })
2223 onCleanup(unsubscribe)
2224 })
2225}
2226
2227const createSubscribeToQueryCacheBatcher = <T,>(
2228 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