Replies: 2 comments 8 replies
-
not sure I fully understand, but my experience with react-native is very limited.
what is expected please? Do you have an example?
cacheTime of 5 minutes has nothing to do with query invalidation. When a query is unused (=not rendered on the screen), it will be removed from the cache (garbage collected) after 5 minutes. But doesn't refetch it. I'm going into more details here: https://tkdodo.eu/blog/practical-react-query#the-defaults-explained
How so? With a staleTime of 0, whenever the component mounts or you e.g. focus the window (not sure how that works in native tbh), a refetch should happen. |
Beta Was this translation helpful? Give feedback.
-
Hello @TkDodo First of all, thank you for your answer. I'm actually working with @devpolo and I will follow up this question.
We expect to get the fresh data from the backend when launching the app
Yes, it should happen, but it doesn't... No way to get fresh data with react-native: 0.63.1 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi every one 👋
Hope you are all doing well
It's been days since I’m facing a react-query problem.
I am using react-query in a react-native app.
In iOS, everything is working as expected.
On the other hand, on Android, the cache is never invalidate, even after the default 5 minutes (by the way, I didn’t modify the default options staleTime and cacheTime because they meet my needs).
For exemple, if I change a product title in my backend, it takes more than 24 hours to get update on my Android app (and 5 minutes on iOS).
Is there any one who can help me understand what is happening ?
react-native: 0.63.1
react-query: 3.9.8
Beta Was this translation helpful? Give feedback.
All reactions