Ryan
Explore posts from serversModify 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
TTCTheo's Typesafe Cult
•Created by Ryan on 6/7/2023 in #questions
How do y'all deal with writing scripts that interact with your t3 apps?
I want to run some scripts locally in my app, that can read my secrets from env.mjs, use my helpers, etc.
I'm running into problems with path aliases, reading from mjs, etc. Has anyone setup a good system for this or have any librarys they know that make this easier?
I want to be able to run
ts-node file.ts
or something similar1 replies
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