Replies: 1 comment
-
Actually, taking a deeper look through the emitted events, it does look like there is a
This should be what I need |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to have the
MutationCache.onMutate
handler called after the specificonMutate
function from the mutation?From poking around I see that the order looks something like
I'd love to be able to have a way to inject something that runs between
mutation.onMutate
andmutation.mutationFn
, preferably without having to modify themutation.mutationFn
.The reason being, is that I want to be able to capture the
context
returned from themutation.onMutate
call.The reason that I'm trying to accomplish this, is that my API has a fairly standardized response pattern, and I also have some specialized ways to build up the mutation options.
I'm trying to use this to my advantage for optimistic updates and just have the
mutation.onMutate
say how it should mutate various query keys but the actualsetQueryData
calls will be done in a single place.Since I do have an abstraction already in place to create the mutation options, I could just place the handler within the
mutationFn
, but that would require a separate event to be fired and handled outside of RQBeta Was this translation helpful? Give feedback.
All reactions