Fix effect SSR: rebind after file load instead of guarding spec
Revert (when (client?) ...) guard in signals.sx — it broke JS tests since client? is false in Node.js too. Instead, rebind effect and register-in-scope as no-ops in sx_server.ml AFTER all .sx files load. The SX definition from signals.sx is replaced only in the OCaml SSR context. JS tests and WASM browser keep the real effect implementation. Remove redundant browser primitive stubs from sx_primitives.ml — only resource SSR stub needed (effect override moved to server setup). JS tests: 1582/1585 (3 VM closure interop remain) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2133,6 +2133,12 @@ let http_mode port =
|
||||
load_dir sx_sx;
|
||||
let t1 = Unix.gettimeofday () in
|
||||
Printf.eprintf "[sx-http] All files loaded in %.3fs\n%!" (t1 -. t0);
|
||||
(* SSR overrides — rebind browser-only functions AFTER .sx files load.
|
||||
effect and register-in-scope are no-ops on the server; the SX definitions
|
||||
from signals.sx are replaced so effect bodies never execute during SSR. *)
|
||||
let bind name fn = ignore (env_bind env name (NativeFn (name, fn))) in
|
||||
bind "effect" (fun _args -> Nil);
|
||||
bind "register-in-scope" (fun _args -> Nil);
|
||||
let jt0 = Unix.gettimeofday () in
|
||||
let count = ref 0 in
|
||||
let compiler_names = [
|
||||
|
||||
Reference in New Issue
Block a user