Skip to content

Commit 8d4923d

Browse files
committed
fix(octane): journal repairedServerParents for hydration rollback
The repairedServerParents WeakSet entry added in save() was never journaled, so a rolled-back hydration attempt (e.g. from suspension) left a stale exemption that could mislead a later hydrateRoot on the same container. Journal the addition for both root hydration rollback (via journalUndo) and speculative attempt rollback (via this.undo), matching the existing remember() pattern.
1 parent 272fd15 commit 8d4923d

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
@@ -19420,7 +19420,14 @@ class HydrationCapability {
1942019420
*/
1942119421
save(parent: Node): void {
1942219422
// An early-bound host losing a server neighbor here has not moved.
19423-
repairedServerParents.add(parent);
19423+
// Journal the exemption so a rolled-back attempt does not leave a stale
19424+
// entry that a later hydrateRoot on the same container could misread.
19425+
if (!repairedServerParents.has(parent)) {
19426+
repairedServerParents.add(parent);
19427+
const cleanup = () => repairedServerParents.delete(parent);
19428+
if (inRootHydrationAttempt()) journalUndo(cleanup);
19429+
if (this.speculative) (this.undo ??= []).push(cleanup);
19430+
}
1942419431
if (inRootHydrationAttempt()) journalRootChildren(parent);
1942519432
if (!this.speculative || (this.saved ??= new Set()).has(parent)) return;
1942619433
this.saved.add(parent);

0 commit comments

Comments
 (0)