Skip to content

New onQuery handler? #278

Discussion options

You must be logged in to vote

Here are the final docs:

Automatic Rollback for Failed Mutations

When you optimistically update your state before performing a mutation, there is a non-zero chance that the mutation will fail. In most cases, you can just trigger a refetch for your optimistic queries to revert them to their true server state. In some circumstances though, refetching may not work correctly and the mutation error could represent some type of server issue that won't make it possible to refetch. In this event, you can instead choose to rollback your update.

To do this, useMutation's onMutate handler option allows you to return a snapshotted rollback value that will later be passed to both onError and onSettled

Replies: 5 comments 20 replies

Comment options

You must be logged in to vote
1 reply
@denisborovikov
Comment options

Comment options

You must be logged in to vote
4 replies
@denisborovikov
Comment options

@tannerlinsley
Comment options

@denisborovikov
Comment options

@denisborovikov
Comment options

Comment options

You must be logged in to vote
8 replies
@tannerlinsley
Comment options

@tannerlinsley
Comment options

@denisborovikov
Comment options

@tannerlinsley
Comment options

@cherniavskii
Comment options

Comment options

You must be logged in to vote
4 replies
@tannerlinsley
Comment options

@denisborovikov
Comment options

@tannerlinsley
Comment options

@cherniavskii
Comment options

Comment options

You must be logged in to vote
3 replies
@cherniavskii
Comment options

@cherniavskii
Comment options

@tannerlinsley
Comment options

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