fix(compiler): preserve server-only component props during hydration
This commit is contained in:
1 parent
bfa72d5679
commit
26af30cfe6
4 files changed
+14
-4
No files matched your search
@@ -3196,7 +3196,7 @@ function __wrnProp(v: unknown): string {
|
||||
function renderPageComponentAttr(
|
||||
attr: Attr,
|
||||
dynamicExpressions: string[],
|
||||
_reactive: PageReactive | null,
|
||||
reactive: PageReactive | null,
|
||||
): string {
|
||||
if (attr.event) {
|
||||
return ` ${componentEventAttribute(attr.name)}="${attrEscape(attr.value)}"`;
|
||||
@@ -3215,6 +3215,13 @@ function renderPageComponentAttr(
|
||||
dynamicExpressions.push(`\${__wrnexusPropAttr(${expression})}`);
|
||||
|
||||
const marker = `\x00WRNEACH${dynamicExpressions.length - 1}\x00`;
|
||||
if (
|
||||
reactive &&
|
||||
exprRefsState(expression, reactive.runtimeStateNames) &&
|
||||
!exprRefsState(expression, reactive.stateNames)
|
||||
) {
|
||||
return ` ${attr.name}="${marker}"`;
|
||||
}
|
||||
// The mount disappears during SSR. Preserve every dynamic component prop
|
||||
// as a parent-owned binding; server-only expressions simply fail closed in
|
||||
// the browser, while page state can continue driving the mounted child.
|
||||
|
||||
Reference in new issue
Block a user