T
TanStack17mo ago
genetic-orange

Reset gcTime

I have a query that is only used for periodic mutations (essentially to keep a session alive). However, the query eventually gets garbage collected. Without setting gcTime to something too long or to infinity, is there a way I can reset gcTime during onSucess of my mutation? The useQueryClient hook is called by the onSucces handler. Thanks!
2 Replies
like-gold
like-gold17mo ago
a query is considered active when you have a component mounted that calls useQuery. if you don't have that, it is eligible for garbage collection.
genetic-orange
genetic-orangeOP17mo ago
Thank you

Did you find this page helpful?