UNPKG

@preact-signals/query

Version:

A reactive utility for React/Preact that simplifies the handling of data fetching and state management. Powered by Preact Signals, it provides hooks and functions to create reactive resources and manage their state seamlessly.

12 lines 754 B
'use client'; import * as React from 'react'; import { notifyManager, parseFilterArgs } from '@tanstack/query-core'; import { useSyncExternalStore } from "./useSyncExternalStore.js"; import { useQueryClient } from "./QueryClientProvider.js"; export function useIsFetching(arg1, arg2, arg3) { const [filters, options = {}] = parseFilterArgs(arg1, arg2, arg3); const queryClient = useQueryClient({ context: options.context }); const queryCache = queryClient.getQueryCache(); return useSyncExternalStore(React.useCallback((onStoreChange) => queryCache.subscribe(notifyManager.batchCalls(onStoreChange)), [queryCache]), () => queryClient.isFetching(filters), () => queryClient.isFetching(filters)); } //# sourceMappingURL=useIsFetching.js.map