Reactive forms pass spreads through instead of wrapping in fragments

adapter-dom.sx: if/when/cond reactive paths now check whether
initial-result is a spread. If so, return it directly — spreads
aren't DOM nodes and can't be appended to fragments. This lets
any spread-returning component (like ~cssx/tw) work inside islands
without the spread being silently dropped.

cssx.sx: revert make-spread workaround — the root cause is now
fixed in the adapter. ~cssx/tw can use a natural top-level if.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 04:51:05 +00:00
parent d42972518a
commit 846719908f
3 changed files with 38 additions and 31 deletions

View File

@@ -476,12 +476,10 @@
(classes (map (fn (r) (get r "cls")) valid))
(rules (map (fn (r) (get r "rule")) valid))
(_ (for-each (fn (rule) (collect! "cssx" rule)) rules)))
;; Return spread: injects class + data-tw onto parent element.
;; The if is inside make-spread's arg so it goes through eval-expr
;; (not render-to-dom), avoiding reactive-if wrapping in islands.
(make-spread (if (empty? classes)
{}
{"class" (join " " classes)
;; Return spread: injects class + data-tw onto parent element
(if (empty? classes)
nil
(make-spread {"class" (join " " classes)
"data-tw" (or tokens "")}))))