Fix island state preservation: revert force-dispose to dispose

The ocaml branch introduced force-dispose-islands-in for outerHTML
swaps, which destroyed hydrated islands (including their live
signals). This broke the core hypermedia+reactive pattern: the
header island's colour state was lost on navigation, and lakes
weren't being morph-updated.

Reverted to production behaviour: dispose-islands-in skips hydrated
islands. The morph algorithm then preserves them (matching by
data-sx-island name) and only morphs their lake content.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-23 17:59:10 +00:00
parent 639a6a2a53
commit 5b370b69e3
2 changed files with 6 additions and 8 deletions

View File

@@ -292,12 +292,10 @@
(content (if select-sel
(select-from-container container select-sel)
(children-to-fragment container))))
;; Dispose old islands before swap.
;; outerHTML replaces the target entirely — force-dispose all islands.
;; Other swap styles (innerHTML, beforeend, etc.) may preserve islands.
(if (= swap-style "outerHTML")
(force-dispose-islands-in target)
(dispose-islands-in target))
;; Dispose non-hydrated islands before swap.
;; Hydrated islands are preserved — the morph algorithm
;; keeps their live signals and only morphs their lakes.
(dispose-islands-in target)
;; Swap
(with-transition use-transition
(fn ()