Fix bridge newline escaping, stepper optimization, dom-listen dedup

- ocaml_sync.py: escape newlines in eval/load_source to prevent
  protocol desync (bridge crashed on any multi-line SX)
- Stepper: do-back uses rebuild-preview (O(1) render) instead of
  replaying all steps. Hydration effect same. Cookie save on button
  click only.
- dom.sx: remove duplicate dom-listen (was shadowing the one at
  line 351 that adapter-dom.sx's dom-on wraps)
- orchestration.sx: fix bind-sse-swap close paren count
- safe_eq: Dict equality via __host_handle for DOM node identity

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-25 15:14:10 +00:00
parent fb8dbeba9f
commit f0f16d24bc
3 changed files with 2 additions and 10 deletions

View File

@@ -97,10 +97,6 @@
(fn (child parent)
(and child parent (host-call parent "contains" child))))
(define dom-listen
(fn (el event-name handler)
(host-call el "addEventListener" event-name (host-callback handler))))
(define dom-attr-list
(fn (el)
;; Return list of (name value) pairs for all attributes on the element.

View File

@@ -132,7 +132,7 @@ class OcamlSync:
def eval(self, source: str) -> str:
"""Evaluate SX source, return result as string."""
self._ensure()
escaped = source.replace("\\", "\\\\").replace('"', '\\"')
escaped = source.replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n")
self._send(f'(eval "{escaped}")')
return self._read_response()
@@ -145,7 +145,7 @@ class OcamlSync:
def load_source(self, source: str) -> str:
"""Load SX source directly into the kernel."""
self._ensure()
escaped = source.replace("\\", "\\\\").replace('"', '\\"')
escaped = source.replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n")
self._send(f'(load-source "{escaped}")')
return self._read_response()

View File

@@ -97,10 +97,6 @@
(fn (child parent)
(and child parent (host-call parent "contains" child))))
(define dom-listen
(fn (el event-name handler)
(host-call el "addEventListener" event-name (host-callback handler))))
(define dom-attr-list
(fn (el)
;; Return list of (name value) pairs for all attributes on the element.