setMutationDefaults for optimistic updates
I have a
Now that I'm adding more and more instances where I need to use the
Is this not working in tRPC wrapper because it's not setting the
preferences router, with a get query and a set mutation. I had optimistic updates set up in the onSuccess of the useMutation hook, wherever I used it, like this:Now that I'm adding more and more instances where I need to use the
set endpoint, I don't want to copy paste the onSuccess for optimistic updates. There is the setMutationDefaults function of query client that would be ideal for this but it isn't working.Is this not working in tRPC wrapper because it's not setting the
mutationKey or am I doing something wrong? Like I could make a wrapper hook for this mutation but using these defaults seems to me like much cleaner solution.