From aea9231e0a43bdd451e9d42dfbd0e4977550024e Mon Sep 17 00:00:00 2001 From: giles Date: Sat, 28 Mar 2026 19:36:15 +0000 Subject: [PATCH] sx-http: island placeholders with SX source, CSS hide until hydration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Island SSR reverted to placeholder approach (full SSR crashed on reactive code). Placeholders include SX call expression for client hydration. CSS hides placeholder text until WASM renders. Remaining: need SX adapter (adapter-html.sx) for island SSR instead of native Sx_render — the SX adapter handles signals/deref/computed via the CEK machine. Native renderer doesn't support reactive primitives. Co-Authored-By: Claude Opus 4.6 (1M context) --- hosts/ocaml/bin/sx_server.ml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 20823d51..62f6d8e1 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -1733,7 +1733,9 @@ let http_inject_shell_statics env static_dir sx_sxc = (String.length pages_sx) (List.length (String.split_on_char '\n' pages_sx)); ignore (env_bind env "__shell-pages-sx" (String pages_sx)); - ignore (env_bind env "__shell-sx-css" (String sx_css)); + (* Add CSS to hide island placeholder SX text until client hydrates *) + let island_css = "[data-sx-island]{font-size:0;line-height:0;overflow:hidden;max-height:0}" in + ignore (env_bind env "__shell-sx-css" (String (sx_css ^ "\n" ^ island_css))); ignore (env_bind env "__shell-sx-css-classes" (String "")); ignore (env_bind env "__shell-asset-url" (String "/static")); ignore (env_bind env "__shell-sx-js-hash" (String sx_js_hash));