RyanR
tRPC3y ago
8 replies
Ryan

Modify the payload before mutating

I have a specific mutation hook that is used all throughout my app, and inside of the hook I want to modify the payload before it is sent to the server (to read something from local storage and add it to payload). Is this possible? I can't seem to find a way to do this. There also isn't a way AFAIK to modify the mutationFn with the nextjs adapter.

My only solution would be redefining mutate and mutateAsync that are modified to do this preprocessing.

Thanks!
Was this page helpful?