Only fetch on "initial" load
I'd like to know what is the best approach to initially fetch data every time the app "starts" (so whenever the user either visits or refreshes the app).
I'm using
Thus I feel I have to invalidate the query (make it stale) whenever the app closes or perhaps when it initially loads. Not sure what is the best approach here.
I'm using
PersistQueryClientProvider to cache data to local storage, so in case the initial new fetch fails, I still have a back-up. I've added cacheTime: Infinity and staleTime: Infinity to the UseQueryOptions of the specific fetch, however, now it only initially fetches once and then never again.Thus I feel I have to invalidate the query (make it stale) whenever the app closes or perhaps when it initially loads. Not sure what is the best approach here.