MCPcopy Index your code
hub / github.com/TanStack/query / useIsFetching

Function useIsFetching

packages/react-query/src/useIsFetching.ts:8–24  ·  view source on GitHub ↗
(
  filters?: QueryFilters,
  queryClient?: QueryClient,
)

Source from the content-addressed store, hash-verified

6import type { QueryClient, QueryFilters } from '@tanstack/query-core'
7
8export function useIsFetching(
9 filters?: QueryFilters,
10 queryClient?: QueryClient,
11): number {
12 const client = useQueryClient(queryClient)
13 const queryCache = client.getQueryCache()
14
15 return React.useSyncExternalStore(
16 React.useCallback(
17 (onStoreChange) =>
18 queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),
19 [queryCache],
20 ),
21 () => client.isFetching(filters),
22 () => client.isFetching(filters),
23 )
24}

Callers 9

WithKnownParametersFunction · 0.90
WithIdentifiersFunction · 0.90
WithKnownParametersFunction · 0.90
WithIdentifiersFunction · 0.90
ExamplesFunction · 0.90
ExamplesFunction · 0.90
RootFunction · 0.90
IsFetchingFunction · 0.50
PageFunction · 0.50

Calls 4

useQueryClientFunction · 0.90
getQueryCacheMethod · 0.80
subscribeMethod · 0.45
isFetchingMethod · 0.45

Tested by 2

IsFetchingFunction · 0.40
PageFunction · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…