Haaxor1689
Transferring huge buffer
I'm using tRPC with superjson serializer in an Electron app. I have a router querry that loads an png image, parses it with
sharp
and sends it as a buffer to client to render inside canvas. For larger files (62MB) I'm getting a Invalid array length
error from superjson though. Can you think of a way to work around this issue?7 replies
Report progress of mutation
I'm using tRPC in a electron app and am running a nodeWorker from main thread. Is there a way to report partial progress to
useMutation
in renderrer thread? I know I could use subscription but is this possible with mutation?7 replies
setMutationDefaults for optimistic updates
I have a
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.5 replies