T
TanStack•3y ago
adverse-sapphire

What makes a query "active"

Couldn't find anywhere in the docs what make a query count as "active" or "live"
3 Replies
sunny-green
sunny-green•3y ago
I believe active queries are the ones that are currently being used by the UI. The inactive ones will appear greyed out in your devtools. Here is a TK blog post for you https://tkdodo.eu/blog/inside-react-query
Inside React Query
Taking a look under the hood of React Query
adverse-sapphire
adverse-sapphire•3y ago
exactly. It's about the amount of QueryObservers. useQuery created an observer. If you have no component mounted that has a useQuery inside, the query is unused/inactive. The number in the devtools is the number of observers, so it's zero in that case.
adverse-sapphire
adverse-sapphireOP•3y ago
Thank you both 💕

Did you find this page helpful?