Skip to content

Commit 5c50f35

Browse files
committed
fix(ssr): include FALLBACK_HOIST_DEPTH in ambient snapshot
saveAmbient/restoreAmbient capture every process-wide SSR global so that nested renderToString/prerender calls cannot leak state into an outer pass. FALLBACK_HOIST_DEPTH was introduced for transitive fallback suppression but omitted from the snapshot, so a nested render starting inside a pending arm would zero the counter and leave it zeroed on return — causing later fallback hoistables to land permanently in the streamed head. Add the counter to the Ambient interface, save it, and restore it.
1 parent 4afa283 commit 5c50f35

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎packages/octane/src/runtime.server.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5499,6 +5499,7 @@ interface Ambient {
54995499
asyncScope: string;
55005500
ssrElement: SsrElementContext | null;
55015501
nestingWarnings: Set<string> | null | undefined;
5502+
fallbackHoistDepth: number;
55025503
vtTrySeq: number;
55035504
vtHasCandidates: boolean;
55045505
vtStack: Array<{ candidate: VtSsrCandidate; consumed: boolean }>;
@@ -5526,6 +5527,7 @@ function saveAmbient(): Ambient {
55265527
asyncScope: ASYNC_SCOPE,
55275528
ssrElement: CURRENT_SSR_ELEMENT,
55285529
nestingWarnings: SSR_NESTING_WARNINGS,
5530+
fallbackHoistDepth: FALLBACK_HOIST_DEPTH,
55295531
vtTrySeq: VT_SSR_TRY_SEQ,
55305532
vtHasCandidates: VT_SSR_HAS_CANDIDATES,
55315533
vtStack: VT_SSR_STACK.map((candidate) => ({ candidate, consumed: candidate.consumed })),
@@ -5554,6 +5556,7 @@ function restoreAmbient(a: Ambient): void {
55545556
ASYNC_SCOPE = a.asyncScope;
55555557
CURRENT_SSR_ELEMENT = a.ssrElement;
55565558
SSR_NESTING_WARNINGS = a.nestingWarnings;
5559+
FALLBACK_HOIST_DEPTH = a.fallbackHoistDepth;
55575560
VT_SSR_TRY_SEQ = a.vtTrySeq;
55585561
VT_SSR_HAS_CANDIDATES = a.vtHasCandidates;
55595562
VT_SSR_STACK.length = 0;

0 commit comments

Comments
 (0)