daltonmenezes / interprocess

💬 A scalable and type-safe Electron IPC management tool with enhanced DX
https://interprocess.daltonmenezes.com
MIT License
95 stars 2 forks source link

Crash without error if a Proxy object is sent through interprocess #3

Closed michael-dm closed 1 year ago

michael-dm commented 1 year ago

If you return a proxy object (for example a reactive object in vue) in a Renderer handler, the webview crashes without outputting any error in main or renderer.

daltonmenezes commented 1 year ago

Hi @michael-dm , have you tried that using raw Electron IPCs?

From the Electron docs:

Electron's IPC implementation uses the HTML standard Structured Clone Algorithm to serialize objects passed between processes, meaning that only certain types of objects can be passed through IPC channels.

Probably, that is the case, because Proxy Objects are not Plain Objects, and it is not serializable as far as I know! About the crash, maybe it's an Electron issue from the version you are using, but it requires investigation.

See:

daltonmenezes commented 1 year ago

@michael-dm check this out to see if any of the answers help you.

michael-dm commented 1 year ago

Yes I'll use toRaw, thanks 👍