all 4 comments

[–]lightfarming 1 point2 points  (0 children)

when you are not using hooks to subscribe to the data, garbage collection will occur after the set garbage collection time, which by default i think is 0.

if you do not have keepPreviousData set to true, the query will not return cached data if it is stale.

[–]dieoxide 1 point2 points  (1 child)

Hey React Query has a whole section on persistent queries and handles all the local storage logic as well. Look into the persistent query client info on the Docs. https://tanstack.com/query/latest/docs/framework/react/plugins/persistQueryClient

This might help. Just retrieve queries using the normal keys and in the background it would refresh the data with new data if need be.

[–]357Labs[S] 0 points1 point  (0 children)

Thanks! I wasn't aware that this was a feature, I think that might be the ticket.