Skip to content

Order of MutationCache.onMutate #8688

Answered by Xiot
Xiot asked this question in General
Discussion options

You must be logged in to vote

Actually, taking a deeper look through the emitted events, it does look like there is a pending event that is fired. Once before, and once after the mutation.onMutate method is called.

// MutationCache.subscribe event = { type: 'updated', action: { type: 'pending', ...} }
// mutation.onMutate
// MutationCache.subscribe event = { type: 'updated', action: { type: 'pending', context: <returned context>, ...} }
// mutation.mutationFn
// MutationCache.subscribe event = { type: 'updated', action: {type: 'success', ... }

This should be what I need

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TkDodo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant