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

Function injectIsFetching

packages/angular-query/src/inject-is-fetching.ts:46–59  ·  view source on GitHub ↗
(
  filters: () => Omit<QueryFilters, 'fetchStatus'> = () => ({}),
)

Source from the content-addressed store, hash-verified

44 * ```
45 */
46export function injectIsFetching(
47 filters: () => Omit<QueryFilters, 'fetchStatus'> = () => ({}),
48): Signal<number> {
49 if (typeof ngDevMode === 'undefined' || ngDevMode) {
50 assertInInjectionContext(injectIsFetching)
51 }
52 const queryClient = inject(QueryClient)
53 const cache = queryClient.getQueryCache()
54
55 return injectExternalStore(() => ({
56 getSnapshot: () => queryClient.isFetching(filters()),
57 subscribe: (onStoreChange) => cache.subscribe(onStoreChange),
58 }))
59}

Callers 3

PageClass · 0.85

Calls 4

injectExternalStoreFunction · 0.90
getQueryCacheMethod · 0.80
isFetchingMethod · 0.45
subscribeMethod · 0.45

Tested by

no test coverage detected