From 2c8afd230d2001c98c59f7c136f4779574664a08 Mon Sep 17 00:00:00 2001 From: giles Date: Mon, 23 Mar 2026 14:38:45 +0000 Subject: [PATCH] Island SSR: spreads work, CSS classes render, context primitive registered MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root causes: - make-spread/spread?/spread-attrs were stubbed (always false/empty) → now create/detect/unwrap Spread values properly - "context" primitive missing from Sx_primitives registry → CEK deref frame handler couldn't read reactive scope stacks Co-Authored-By: Claude Opus 4.6 (1M context) --- hosts/ocaml/bin/sx_server.ml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hosts/ocaml/bin/sx_server.ml b/hosts/ocaml/bin/sx_server.ml index 9f3ec4a..4c56206 100644 --- a/hosts/ocaml/bin/sx_server.ml +++ b/hosts/ocaml/bin/sx_server.ml @@ -565,8 +565,21 @@ let make_server_env () = | [Component c] -> Env c.c_closure | [Island i] -> Env i.i_closure | _ -> Dict (Hashtbl.create 0)); - bind "spread?" (fun _args -> Bool false); - bind "spread-attrs" (fun _args -> Dict (Hashtbl.create 0)); + bind "spread?" (fun args -> + match args with [Spread _] -> Bool true | _ -> Bool false); + bind "spread-attrs" (fun args -> + match args with + | [Spread pairs] -> + let d = Hashtbl.create 4 in + List.iter (fun (k, v) -> Hashtbl.replace d k v) pairs; + Dict d + | _ -> Dict (Hashtbl.create 0)); + bind "make-spread" (fun args -> + match args with + | [Dict d] -> + let pairs = Hashtbl.fold (fun k v acc -> (k, v) :: acc) d [] in + Spread pairs + | _ -> Nil); bind "is-html-tag?" (fun args -> match args with | [String s] -> Bool (Sx_render.is_html_tag s)