From 6192bb872744489739ce4f41268a02b63d2dab4e Mon Sep 17 00:00:00 2001 From: John Carmack Date: Thu, 7 May 2026 17:40:33 -0700 Subject: [PATCH] add changeset for channel reuse fix --- .changeset/allow-channel-reuse.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .changeset/allow-channel-reuse.md diff --git a/.changeset/allow-channel-reuse.md b/.changeset/allow-channel-reuse.md new file mode 100644 index 0000000..1337ea3 --- /dev/null +++ b/.changeset/allow-channel-reuse.md @@ -0,0 +1,11 @@ +--- +"@fltsci/taurpc": patch +--- + +Allow `Channel`s to be reused across multiple TauRPC command invocations. + +Previously, when a command argument contained a `Channel` and the runtime ran a transform pass (e.g. semantic-types decoding), the generated TS proxy mutated the original channel's `onmessage` handler in place. Passing the same channel to a second command (or any code path that re-invoked the proxy) would re-wrap the already-wrapped handler, double-decoding payloads. + +The proxy now wraps via `new Channel((response) => v.onmessage(transform(response)))` instead of mutating, so the original channel is untouched and safe to reuse. + +Generated bindings now import `Channel` from `@tauri-apps/api/core` whenever the affected transform path is reachable.