T
TanStack3y ago
yappiest-sapphire

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
fascinating-indigo
fascinating-indigo3y 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
yappiest-sapphire
yappiest-sapphireOP3y ago
Is {type:'active'} not exactly that?

Did you find this page helpful?