-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed
Labels
status: needs triageThis issue needs to triage, applied to new issuesThis issue needs to triage, applied to new issuestype: bug
Description
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:
type Message = { message: string };
const secondWindow = new WebviewWindow("secondWindow", { /* ... */ });
secondWindow.listen<Message>("message-sent", (e) => console.log(e.payload.message)); // ERROR: `e.payload` is a stringIn the secondary window:
const mainWindow = WebviewWindow.getByLabel("main");
mainWindow?.emit("message-sent", { message: "Hello from other window!" });Expected behavior
e.payload should be an object instead of a string.
Platform and versions
Environment
› OS: Windows 10.0.22621 X64
› Webview2: 106.0.1370.52
› MSVC:
- Visual Studio Build Tools 2022
› Node.js: 16.17.1
› npm: 8.15.0
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.25.1
› rustc: 1.64.0
› cargo: 1.64.0
› Rust toolchain: stable-x86_64-pc-windows-msvc
Packages
› @tauri-apps/cli [NPM]: 1.1.1
› @tauri-apps/api [NPM]: 1.1.0
› tauri [RUST]: 1.1.1,
› tauri-build [RUST]: 1.1.1,
› tao [RUST]: 0.14.0,
› wry [RUST]: 0.21.1,
App
› build-type: bundle
› CSP: unset
› distDir: ../build
› devPath: http://localhost:5173/
› framework: Svelte
App directory structure
├─ .git
├─ .svelte-kit
├─ build
├─ node_modules
├─ src
├─ src-tauri
└─ static
Stack trace
No response
Additional context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
status: needs triageThis issue needs to triage, applied to new issuesThis issue needs to triage, applied to new issuestype: bug