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

Function useIsFetching

packages/react-query/src/useIsFetching.ts:40–56  ·  view source on GitHub ↗
(
  filters?: Omit<QueryFilters, 'fetchStatus'>,
  queryClient?: QueryClient,
)

Source from the content-addressed store, hash-verified

38 * ```
39 */
40export function useIsFetching(
41 filters?: Omit<QueryFilters, 'fetchStatus'>,
42 queryClient?: QueryClient,
43): number {
44 const client = useQueryClient(queryClient)
45 const queryCache = client.getQueryCache()
46
47 return React.useSyncExternalStore(
48 React.useCallback(
49 (onStoreChange) =>
50 queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),
51 [queryCache],
52 ),
53 () => client.isFetching(filters),
54 () => client.isFetching(filters),
55 )
56}

Callers 12

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

Calls 4

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

Tested by 3

PageFunction · 0.40
IsFetchingFunction · 0.40
PageFunction · 0.40