From 1e42eb62a2a04c3ae52ef7ee9f61d6fcaf3d71f2 Mon Sep 17 00:00:00 2001 From: giles Date: Wed, 25 Mar 2026 14:10:28 +0000 Subject: [PATCH] Fix create-text-node in DOM adapter: host handle Dicts are DOM nodes The DOM adapter treated all Dict values as empty (create-fragment). But DOM nodes (text nodes, elements) from create-text-node/host-call are wrapped as Dict { __host_handle: N } by js_of_ocaml. Now checks for __host_handle and passes them through as DOM nodes. Fixes stopwatch button text ("Start") and timer display ("0.0s") which were missing because create-text-node results were discarded. Co-Authored-By: Claude Opus 4.6 (1M context) --- shared/static/wasm/sx/adapter-dom.sx | 6 ++++-- web/adapter-dom.sx | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/shared/static/wasm/sx/adapter-dom.sx b/shared/static/wasm/sx/adapter-dom.sx index 1f2b43a6..2c23bae4 100644 --- a/shared/static/wasm/sx/adapter-dom.sx +++ b/shared/static/wasm/sx/adapter-dom.sx @@ -75,8 +75,10 @@ (scope-emit! "element-attrs" (spread-attrs expr))) expr) - ;; Dict → empty - "dict" (create-fragment) + ;; Dict → check for host DOM node, else empty fragment + "dict" (if (has-key? expr "__host_handle") + expr ;; Host DOM node (text node, element, etc.) — pass through + (create-fragment)) ;; List → dispatch "list" diff --git a/web/adapter-dom.sx b/web/adapter-dom.sx index 1f2b43a6..2c23bae4 100644 --- a/web/adapter-dom.sx +++ b/web/adapter-dom.sx @@ -75,8 +75,10 @@ (scope-emit! "element-attrs" (spread-attrs expr))) expr) - ;; Dict → empty - "dict" (create-fragment) + ;; Dict → check for host DOM node, else empty fragment + "dict" (if (has-key? expr "__host_handle") + expr ;; Host DOM node (text node, element, etc.) — pass through + (create-fragment)) ;; List → dispatch "list"