T
TanStack2y ago
sensitive-blue

How to check if there's a currently used query in cache

I need to check if there's an active query being used in the UI. I tried with
queryClient.getQueryData | getQueryState (queryKey, {type:'active'})
queryClient.getQueryData | getQueryState (queryKey, {type:'active'})
but am always getting undefined.
2 Replies
deep-jade
deep-jade2y ago
useIsFetching | TanStack Query Docs
useIsFetching is an optional hook that returns the number of the queries that your application is loading or fetching in the background (useful for app-wide loading indicators). `tsx
sensitive-blue
sensitive-blueOP2y ago
Is {type:'active'} not exactly that?

Did you find this page helpful?