You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two Tauri windows communicating with each other via events on the frontend. I would like to send an object from one window to another. From my understanding, the serialized JSON should be parsed automatically on the receiving end, but instead I'm getting the string representation. This does not seem to be intended behavior.
typeMessage={message: string};constsecondWindow=newWebviewWindow("secondWindow",{/* ... */});secondWindow.listen<Message>("message-sent",(e)=>console.log(e.payload.message));// ERROR: `e.payload` is a string
In the secondary window:
constmainWindow=WebviewWindow.getByLabel("main");mainWindow?.emit("message-sent",{message: "Hello from other window!"});
Expected behavior
e.payload should be an object instead of a string.
I did some investigations and the situation is bad. In JS -> JS/Rust events, payload is serialized to string and then dispatched as string to both JS and Rust listeners but Rust -> JS/Rust will be dispatched to JS as object and as String to Rust. cc @lucasfernog
Describe the bug
I have two Tauri windows communicating with each other via events on the frontend. I would like to send an object from one window to another. From my understanding, the serialized JSON should be parsed automatically on the receiving end, but instead I'm getting the string representation. This does not seem to be intended behavior.
Possibly related: #2929
Reproduction
In the main window:
In the secondary window:
Expected behavior
e.payload
should be an object instead of a string.Platform and versions
Stack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: