fix(compiler): render server loader attributes without client state
This commit is contained in:
1 parent
6acf78a72c
commit
aec1dc6056
4 files changed
+40
-5
No files matched your search
@@ -344,10 +344,16 @@ function renderAttrs(
|
||||
exprRefsState(expression, reactive.runtimeStateNames) &&
|
||||
dynamicExpressions
|
||||
) {
|
||||
const marker = exprRefsState(expression, reactive.stateNames)
|
||||
? ` data-wrn-bind-${bindIndex++}="${attrEscape(JSON.stringify([attr.name, attr.value]))}"`
|
||||
: "";
|
||||
if (isHtmlBooleanAttribute(attr.name)) {
|
||||
dynamicExpressions.push(`\${(${expression}) ? ${JSON.stringify(` ${attr.name}`)} : ""}`);
|
||||
return `\x00WRNEACH${dynamicExpressions.length - 1}\x00${marker}`;
|
||||
}
|
||||
dynamicExpressions.push(`\${__wrnexusPropAttr(${expression})}`);
|
||||
const sentinel = `\x00WRNEACH${dynamicExpressions.length - 1}\x00`;
|
||||
const marker = JSON.stringify([attr.name, attr.value]);
|
||||
return ` ${attr.name}="${sentinel}" data-wrn-bind-${bindIndex++}="${attrEscape(marker)}"`;
|
||||
return ` ${attr.name}="${sentinel}"${marker}`;
|
||||
}
|
||||
const initial = reactiveAttrValue(attr.value, reactive);
|
||||
if (initial === null) return base;
|
||||
@@ -1603,7 +1609,7 @@ function generateInner(ast: PageAst): string {
|
||||
];
|
||||
const runtimeStateNames = runtimeComputedNames(orderedStates, orderedComputed, runtimeRoots);
|
||||
const reactive: PageReactive | null =
|
||||
reactiveNames.length > 0
|
||||
reactiveNames.length > 0 || runtimeStateNames.size > 0
|
||||
? { stateNames: new Set(reactiveNames), runtimeStateNames, scope: seedScope }
|
||||
: null;
|
||||
const loops: string[] = [];
|
||||
|
||||
Reference in new issue
Block a user