Ryan
Ryan
TtRPC
Created by Ryan on 9/28/2023 in #❓-help
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!
9 replies
TtRPC
Created by Ryan on 4/28/2023 in #❓-help
Can you return from an API endpoint before a sync operation is complete?
I'm curious, if I have an endpoint that saves something to a DB and I choose to return from the endpoint without waiting for the DB call to finish, is it possible the server will shut down before the DB call is complete? I ran into this problem in a previous project where I was using AWS Lamdas, not Next or TRPC. I didn't want to wait for sync operations to complete if I didn't need the data in my API response, but I found that the Lambda would be shut down once I returned and often my processes would not be completed. Thanks!
34 replies