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:
@@ -14,7 +14,7 @@
|
||||
// =========================================================================
|
||||
|
||||
var NIL = Object.freeze({ _nil: true, toString: function() { return "nil"; } });
|
||||
var SX_VERSION = "2026-03-13T04:16:14Z";
|
||||
var SX_VERSION = "2026-03-13T04:50:39Z";
|
||||
|
||||
function isNil(x) { return x === NIL || x === null || x === undefined; }
|
||||
function isSxTruthy(x) { return x !== false && !isNil(x); }
|
||||
@@ -2019,7 +2019,7 @@ return (function() { var _m = typeOf(expr); if (_m == "nil") return createFragme
|
||||
})();
|
||||
return (isSxTruthy(domParent(marker)) ? (forEach(function(n) { return domRemove(n); }, currentNodes), (currentNodes = (isSxTruthy(domIsFragment(result)) ? domChildNodes(result) : [result])), domInsertAfter(marker, result)) : (initialResult = result));
|
||||
})(); });
|
||||
return (function() {
|
||||
return (isSxTruthy(isSpread(initialResult)) ? initialResult : (function() {
|
||||
var frag = createFragment();
|
||||
domAppend(frag, marker);
|
||||
if (isSxTruthy(initialResult)) {
|
||||
@@ -2027,7 +2027,7 @@ return (function() { var _m = typeOf(expr); if (_m == "nil") return createFragme
|
||||
domAppend(frag, initialResult);
|
||||
}
|
||||
return frag;
|
||||
})();
|
||||
})());
|
||||
})() : (function() {
|
||||
var condVal = trampoline(evalExpr(nth(expr, 1), env));
|
||||
return (isSxTruthy(condVal) ? renderToDom(nth(expr, 2), env, ns) : (isSxTruthy((len(expr) > 3)) ? renderToDom(nth(expr, 3), env, ns) : createFragment()));
|
||||
@@ -2046,14 +2046,14 @@ return (function() { var _m = typeOf(expr); if (_m == "nil") return createFragme
|
||||
currentNodes = domChildNodes(frag);
|
||||
return (initialResult = frag);
|
||||
})() : NIL)); });
|
||||
return (function() {
|
||||
return (isSxTruthy(isSpread(initialResult)) ? initialResult : (function() {
|
||||
var frag = createFragment();
|
||||
domAppend(frag, marker);
|
||||
if (isSxTruthy(initialResult)) {
|
||||
domAppend(frag, initialResult);
|
||||
}
|
||||
return frag;
|
||||
})();
|
||||
})());
|
||||
})() : (isSxTruthy(!isSxTruthy(trampoline(evalExpr(nth(expr, 1), env)))) ? createFragment() : (function() {
|
||||
var frag = createFragment();
|
||||
{ var _c = range(2, len(expr)); for (var _i = 0; _i < _c.length; _i++) { var i = _c[_i]; domAppend(frag, renderToDom(nth(expr, i), env, ns)); } }
|
||||
@@ -2074,14 +2074,14 @@ return (function() { var _m = typeOf(expr); if (_m == "nil") return createFragme
|
||||
return (initialResult = result);
|
||||
})() : NIL));
|
||||
})(); });
|
||||
return (function() {
|
||||
return (isSxTruthy(isSpread(initialResult)) ? initialResult : (function() {
|
||||
var frag = createFragment();
|
||||
domAppend(frag, marker);
|
||||
if (isSxTruthy(initialResult)) {
|
||||
domAppend(frag, initialResult);
|
||||
}
|
||||
return frag;
|
||||
})();
|
||||
})());
|
||||
})() : (function() {
|
||||
var branch = evalCond(rest(expr), env);
|
||||
return (isSxTruthy(branch) ? renderToDom(branch, env, ns) : createFragment());
|
||||
|
||||
Reference in New Issue
Block a user