-
Describe the bugExpo, React Native: Data still stale after mutation and query invalidation. Situation: I mutate data displayed on the current screen and then invalidate queries in the 'onSettled' or the 'onSuccess' section.
Your minimal, reproducible exampleNA Steps to reproduceNA Expected behaviorNA How often does this bug happen?No response Screenshots or VideosNo response PlatformWindows 10, react-query version^3.39.1 TypeScript versionNo response Additional contextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
well, without knowing what your backend is doing, it just seems to me that:
fires off a mutation, but doesn't wait for Of course, this is just a guess with incomplete information, but have you tried actually returning a Promise from the mutationFn? Also, moving to discussion, because there is no bug without a reproduction. |
Beta Was this translation helpful? Give feedback.
well, without knowing what your backend is doing, it just seems to me that:
fires off a mutation, but doesn't wait for
deleteCategory
to finish. That indicates thatonSuccess
is called immediately, invalidating the query. That will in turn refetch the query, but the deletion has not yet happened, thus you'll get back the same result from the backend.Of course, this is just a guess with incomplete information, but have you tried actually returning a Promise from the mutationFn?
Also, moving to discussion, because there is no bug without a reproduction.