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:
@@ -97,10 +97,6 @@
|
|||||||
(fn (child parent)
|
(fn (child parent)
|
||||||
(and child parent (host-call parent "contains" child))))
|
(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
|
(define dom-attr-list
|
||||||
(fn (el)
|
(fn (el)
|
||||||
;; Return list of (name value) pairs for all attributes on the element.
|
;; Return list of (name value) pairs for all attributes on the element.
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class OcamlSync:
|
|||||||
def eval(self, source: str) -> str:
|
def eval(self, source: str) -> str:
|
||||||
"""Evaluate SX source, return result as string."""
|
"""Evaluate SX source, return result as string."""
|
||||||
self._ensure()
|
self._ensure()
|
||||||
escaped = source.replace("\\", "\\\\").replace('"', '\\"')
|
escaped = source.replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n")
|
||||||
self._send(f'(eval "{escaped}")')
|
self._send(f'(eval "{escaped}")')
|
||||||
return self._read_response()
|
return self._read_response()
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ class OcamlSync:
|
|||||||
def load_source(self, source: str) -> str:
|
def load_source(self, source: str) -> str:
|
||||||
"""Load SX source directly into the kernel."""
|
"""Load SX source directly into the kernel."""
|
||||||
self._ensure()
|
self._ensure()
|
||||||
escaped = source.replace("\\", "\\\\").replace('"', '\\"')
|
escaped = source.replace("\\", "\\\\").replace('"', '\\"').replace("\n", "\\n")
|
||||||
self._send(f'(load-source "{escaped}")')
|
self._send(f'(load-source "{escaped}")')
|
||||||
return self._read_response()
|
return self._read_response()
|
||||||
|
|
||||||
|
|||||||
@@ -97,10 +97,6 @@
|
|||||||
(fn (child parent)
|
(fn (child parent)
|
||||||
(and child parent (host-call parent "contains" child))))
|
(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
|
(define dom-attr-list
|
||||||
(fn (el)
|
(fn (el)
|
||||||
;; Return list of (name value) pairs for all attributes on the element.
|
;; Return list of (name value) pairs for all attributes on the element.
|
||||||
|
|||||||
Reference in New Issue
Block a user