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

Function useIsFetching

packages/preact-query/src/useIsFetching.ts:40–55  ·  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 useSyncExternalStore(
48 useCallback(
49 (onStoreChange) =>
50 queryCache.subscribe(notifyManager.batchCalls(onStoreChange)),
51 [queryCache],
52 ),
53 () => client.isFetching(filters),
54 )
55}

Callers 3

IsFetchingFunction · 0.50
PageFunction · 0.50

Calls 5

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

Tested by 2

IsFetchingFunction · 0.40
PageFunction · 0.40