Skip to content

Expo: Displayed data is stale #3727

Answered by TkDodo
mansum6 asked this question in General
Jun 19, 2022 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

well, without knowing what your backend is doing, it just seems to me that:

    (id) => {
      deleteCategory({ categoryID: id, saveItems: true });
    },

fires off a mutation, but doesn't wait for deleteCategory to finish. That indicates that onSuccess 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.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@mansum6
Comment options

@TkDodo
Comment options

Answer selected by mansum6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #3722 on June 20, 2022 18:54.