Skip to content

Commit 741d38f

Browse files
committed
fix(compiler): do not treat stable identifiers as static in children positions
Children expression containers can hold renderables that must resolve in the correct render scope. The stable-name optimization is valid for host attributes (just string coercion, no scope dependency) but not for children: on the server, a body call renders the tree to HTML immediately, so a renderable like `{children}` would expand in the caller's scope instead of where it mounts. Without the optimization, jsxValueChildrenNeedRenderScope correctly returns true for identifier children, causing directCallReturnKind to emit 'fragment'/'value' and letting the server take the deferred path that matches the client.
1 parent 7483954 commit 741d38f

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

‎packages/octane/src/compiler/compile.js‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20671,11 +20671,10 @@ function directCallReturnKind(node, fn, ctx) {
2067120671
if (requiresTemplateNormalization(node, 'html', true, ctx)) return 'fragment';
2067220672
const stable = directCallStableNames(fn);
2067320673
if (node.type !== 'Element' && node.type !== 'JSXElement') {
20674-
return jsxValueChildrenNeedRenderScope(node, false, stable) ? 'value' : null;
20674+
return jsxValueChildrenNeedRenderScope(node, false) ? 'value' : null;
2067520675
}
2067620676
if (isComponentTag(node)) return 'value';
20677-
return jsxValueRootNeedsRenderScope(node, stable) ||
20678-
jsxValueChildrenNeedRenderScope(node, false, stable)
20677+
return jsxValueRootNeedsRenderScope(node, stable) || jsxValueChildrenNeedRenderScope(node, false)
2067920678
? 'fragment'
2068020679
: null;
2068120680
}

0 commit comments

Comments
 (0)