Fix infinite scroll and all sx-trigger/sx-get element binding

Root cause: process-elements during WASM boot-init marks elements as
processed but process-one silently fails (effect functions don't execute
in WASM boot context). Deferred process-elements then skips them.

Fixes:
- boot-init: defer process-elements via set-timeout 0
- hydrate-island: defer process-elements via set-timeout 0
- process-elements: move mark-processed! after process-one so failed
  boot-context calls don't poison the flag
- observe-intersection: native JS platform function (K.registerNative)
  to avoid bytecode callback issue with IntersectionObserver
- Remove SX observe-intersection from boot-helpers.sx (was overriding
  the working native version)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 00:17:02 +00:00
parent 9594362427
commit 90a2eaaf7a
4 changed files with 22 additions and 17 deletions

View File

@@ -321,7 +321,7 @@
(dom-set-text-content el "")
(dom-append el body-dom)
(dom-set-data el "sx-disposers" disposers)
(process-elements el)
(set-timeout (fn () (process-elements el)) 0)
(log-info
(str
"hydrated island: "
@@ -430,7 +430,7 @@
(sx-hydrate-elements nil)
(sx-hydrate-islands nil)
(run-post-render-hooks)
(process-elements nil)
(set-timeout (fn () (process-elements nil)) 0)
(dom-listen (dom-window) "popstate" (fn (e) (handle-popstate 0)))
(dom-set-attr
(host-get (dom-document) "documentElement")