T
TanStack3y ago
rare-sapphire

Queries become inactive and disappear from devtools

Occasionally, my query will move to the "inactive" section of the devtools and become unresponsive or disappear from the devtools entirely. How can I avoid this? I am building a document editor and using React Query to periodically refetch new versions and mutate to persist changes, so it is important that the query is always active while the user is on the page. Next 13.4.6, Tanstack Query 4.29.14
5 Replies
metropolitan-bronze
metropolitan-bronze3y ago
queries are inactive when there is no component mounted that uses it via "useQuery"
rare-sapphire
rare-sapphireOP3y ago
is this maybe some weird interaction with the hot reloading? like when I hot reload the page the component is unmounted so the query becomes inactive? (I'm not sure the implementation details so I don't know exactly what behavior to expect here)
metropolitan-bronze
metropolitan-bronze3y ago
Maybe, not sure
unwilling-turquoise
unwilling-turquoise2y ago
I have a question related to this one - will all queries made via client.fetchQuery automatically be considered inactive since they aren't made via the hook?
metropolitan-bronze
metropolitan-bronze2y ago
yes. queries are only active if they have a QueryObserver, which is created by useQuery.

Did you find this page helpful?