Fix renderStrComponent with same eager-eval pattern as renderComponentDOM
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m18s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m18s
The string renderer's component call had the same deferred-evaluation bug — and this is the path actually used for blog card rendering via renderToString. Apply the same _isRenderExpr check to route render-only forms through renderStr while data expressions go through sxEval. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1110,10 +1110,18 @@
|
|||||||
var i = 0;
|
var i = 0;
|
||||||
while (i < args.length) {
|
while (i < args.length) {
|
||||||
if (isKw(args[i]) && i + 1 < args.length) {
|
if (isKw(args[i]) && i + 1 < args.length) {
|
||||||
|
// Evaluate kwarg values eagerly in the caller's env so expressions
|
||||||
|
// like (get t "src") resolve while lambda params are still bound.
|
||||||
|
// Render-only forms (HTML tags, <>, ~comp) go through renderStr.
|
||||||
var v = args[i + 1];
|
var v = args[i + 1];
|
||||||
kwargs[args[i].name] = (typeof v === "string" || typeof v === "number" ||
|
if (typeof v === "string" || typeof v === "number" ||
|
||||||
typeof v === "boolean" || isNil(v) || isKw(v))
|
typeof v === "boolean" || isNil(v)) {
|
||||||
? v : (isSym(v) ? sxEval(v, env) : v);
|
kwargs[args[i].name] = v;
|
||||||
|
} else if (_isRenderExpr(v)) {
|
||||||
|
kwargs[args[i].name] = new RawHTML(renderStr(v, env));
|
||||||
|
} else {
|
||||||
|
kwargs[args[i].name] = sxEval(v, env);
|
||||||
|
}
|
||||||
i += 2;
|
i += 2;
|
||||||
} else { children.push(args[i]); i++; }
|
} else { children.push(args[i]); i++; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user