Skip to content

useMutation 'invalidates' field #7324

Answered by TkDodo
UltimateGG asked this question in Ideas
Discussion options

You must be logged in to vote

With the removal of the onSuccess

onSuccess wasn't removed from mutations ...

as its a very common pattern.

there are too many different cases to consider, for example:

  • should this run in onSuccess or in onSettled ?
  • should the invalidations be awaited, or should they fire as background refetches. The differences determines how long the mutation itself stays in pending state.
  • what happens if you provide additional invalidations in callbacks? Will they be merged or will they cancel each other out?
  • do you only allow one key, or should it be an array of keys?

Because of questions like this, and likely everybody expecting something slightly different depending on their use-case, we haven…

Replies: 1 comment 2 replies

Comment options

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

@TkDodo
Comment options

Answer selected by UltimateGG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants