Closed jthrilly closed 1 year ago
Hey @jthrilly, thanks so much for reporting this issue! I don't think I would have personally run into this anytime soon 😅
Sorry for the delay getting back to you... I've pushed a patch up and it's out now in electron-trpc@0.4.2
.
Please let me know if you have any more issues. Thanks again!
I noticed a crash when using this lib with
superjson
. The stack trace indicated thatsuperjson.deserialize
was being called with the input being undefined.A little digging and console logging led me to notice that this was happening for
subscription.stop
methods (which are being emitted here: https://github.com/jsonnull/electron-trpc/blob/main/packages/electron-trpc/src/renderer/ipcLink.ts#L77-L80) because they don't have aninput
property.Thus when the
handleIPCOperation
function picks this up on the main thread, it is callingdeserialize
on an empty object (here: https://github.com/jsonnull/electron-trpc/blob/main/packages/electron-trpc/src/main/handleIPCOperation.ts#L23).Seems like this function needs to look for the presence of
operation.input
before callingdeserialize
, or else filter by the operation method if it is a stable API.