Skip to content

Commit b0867e4

Browse files
committed
fix(octane): resolve enclosing owner for renderers under lite components
A renderer (host-descriptor or fragment) whose parentBlock is a LiteBlockImpl never recorded enclosingOwner because the existing LiteBlockImpl guard dropped it. The t: path avoided this by falling through to signalInstanceParent (the lite scope), but a renderer copies the parent's key recipe so keys match and the fallback never triggers. Add a liteScope back-reference on LiteBlockImpl so scopeSignalOwner can resolve through the stand-in to the owning scope.
1 parent f5f44d5 commit b0867e4

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎packages/octane/src/runtime.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,8 @@ function scopeSignalOwner(scope: Scope | null): SignalOwner | undefined {
11311131
scope.signalInstanceSite === TEMPLATE_INVOCATION_SITE ? scope.signalInstanceParent : null;
11321132
if (parent !== null && !(parent instanceof LiteBlockImpl))
11331133
identity.enclosingOwner = scopeSignalOwner(parent) as SignalRendererOwnerIdentity;
1134+
else if (parent instanceof LiteBlockImpl)
1135+
identity.enclosingOwner = scopeSignalOwner(parent.liteScope) as SignalRendererOwnerIdentity;
11341136
// A retry owner must not keep an abandoned renderer tree alive. This
11351137
// existing opaque identity object is also its own facade-state token.
11361138
identity.instanceOwner = identity;
@@ -11849,8 +11851,13 @@ class LiteBlockImpl {
1184911851
declare signalInstanceValue: unknown;
1185011852
declare signalInstanceHasKey: boolean;
1185111853
declare signalInstanceResolved: string | undefined;
11854+
// Back-reference to the lite scope whose block this stand-in is. A renderer
11855+
// child's parentBlock is this stand-in, and scopeSignalOwner needs the scope
11856+
// to resolve the enclosing owner (the lite scope is not reachable from the
11857+
// parentBlock chain alone).
11858+
declare liteScope: Scope;
1185211859

11853-
constructor(parentNode: Node, endMarker: Node | null, parentBlock: Block) {
11860+
constructor(parentNode: Node, endMarker: Node | null, parentBlock: Block, liteScope: Scope) {
1185411861
this.parentNode = parentNode;
1185511862
this.endMarker = endMarker;
1185611863
this.parentBlock = parentBlock;
@@ -11862,6 +11869,7 @@ class LiteBlockImpl {
1186211869
this.signalInstanceValue = undefined;
1186311870
this.signalInstanceHasKey = false;
1186411871
this.signalInstanceResolved = undefined;
11872+
this.liteScope = liteScope;
1186511873
}
1186611874
}
1186711875

@@ -11980,7 +11988,7 @@ export function componentSlotLite<P>(
1198011988
endMarker = hydration.parkAtHole((inPlace = anchor));
1198111989
}
1198211990
}
11983-
scope.block = new LiteBlockImpl(host, endMarker, parentScope.block) as unknown as Block;
11991+
scope.block = new LiteBlockImpl(host, endMarker, parentScope.block, scope) as unknown as Block;
1198411992
stampSignalInstance(scope, parentScope, invocationSite);
1198511993
if (adoptedOpen !== null && adoptedClose !== null) {
1198611994
hydration!.liteRanges.set(scope, {

0 commit comments

Comments
 (0)