T
TanStack2y ago
metropolitan-bronze

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
extended-salmon
extended-salmon2y 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.
metropolitan-bronze
metropolitan-bronzeOP2y ago
Thank you

Did you find this page helpful?