Skip to content

Commit 1fdc657

Browse files
committed
fix(octane): prune signal retry visits from lite component scopes
scopeSignalOwner records a SIGNAL_RETRY_VISIT for any fresh scope that consults a retry cache, but only renderBlock claimed and pruned it. Lite components (componentSlotLite) also call scopeSignalOwner yet invoke the body directly, so the visit was never pruned — leaving replaced or removed query$ entries cached until the boundary resolved. Two issues fixed: 1. LiteBlockImpl has no 'mounted' field, so scope.block.mounted was always undefined and a visit was recorded on every render, not just mount. Changed the check to scope.mounted which is correct for both Block (where scope === block) and lite ScopeImpl paths. 2. Added retry-visit claim and prune logic to componentSlotLite, mirroring renderBlock: claim after scopeSignalOwner, prune on success, and prune with suspended=true on SuspenseException.
1 parent a0b029b commit 1fdc657

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎packages/octane/src/runtime.ts‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,7 +1181,7 @@ function scopeSignalOwner(scope: Scope | null): SignalOwner | undefined {
11811181
node.owner = undefined;
11821182
cache.owners.delete(owner);
11831183
}
1184-
if (path !== null && !scope.block.mounted) visit = { scope, cache, path };
1184+
if (path !== null && !scope.mounted) visit = { scope, cache, path };
11851185
}
11861186
if (owner === undefined || owner.documentOwner !== documentOwner) {
11871187
const instanceKey = resolveSignalInstanceKey(scope);
@@ -12152,18 +12152,25 @@ export function componentSlotLite<P>(
1215212152
let claimed: Node | null | undefined;
1215312153
const outerClaim =
1215412154
adoptedOpen === null ? undefined : hydration!.beginClaim(getNextSibling(adoptedOpen));
12155+
let retryVisit: SignalRetryVisit | null = null;
1215512156
try {
1215612157
if (signalDocumentEnabled || scope.block.idState.renderOwner?.signalOwner !== undefined) {
1215712158
// Same owner-resolution order as runWithBlockSignalOwner, but the
1215812159
// per-mount closure only exists when the owner actually changes.
1215912160
const owner = scopeSignalOwner(scope);
1216012161
if (owner !== undefined) STREAMED_SIGNAL_OWNER_ACTIVATOR?.(owner);
12162+
if (SIGNAL_RETRY_VISIT !== null) {
12163+
if (SIGNAL_RETRY_VISIT.scope === scope) retryVisit = SIGNAL_RETRY_VISIT;
12164+
SIGNAL_RETRY_VISIT = null;
12165+
}
1216112166
if (owner === undefined || currentSignalOwner() === owner) {
1216212167
comp(props, scope, undefined);
1216312168
} else runWithSignalOwner(owner, () => comp(props, scope, undefined));
1216412169
} else comp(props, scope, undefined);
12170+
if (retryVisit !== null) pruneSignalRetryVisit(retryVisit, false);
1216512171
if (!scope.mounted) scope.mounted = true;
1216612172
} catch (error) {
12173+
if (retryVisit !== null && isSuspenseException(error)) pruneSignalRetryVisit(retryVisit, true);
1216712174
profileDidThrow = true;
1216812175
profileThrown = error;
1216912176
throw error;

0 commit comments

Comments
 (0)