Bug: 19.2 batched Suspense reveal can consume the wrong completion segment when a resumed (PPR) stream reuses a queued segment id — DOM corruption + hydration failure#37078
Summary
Since React 19.2's batched Suspense reveal ("Batching Suspense Boundaries for SSR streaming"), the inline completeBoundary runtime ($RC) no longer consumes its content segment synchronously — it queues (boundary, content) pairs into $RB and consumes them in a deferred revealCompletedBoundaries ($RV) flush (rAF, then a ~300ms/2.3s-LCP throttle). The queued content segment <div hidden id="S:n"> therefore stays in the DOM with its id until the flush.
In a prerender+resume (PPR) document, the resume stream's segment ids are allocated independently of the prerender's, so a resume segment can legally reuse an id the shell already used for a boundary completion — one document containing two <div hidden id="S:4"> (the shell boundary B:4's completion segment, and the resume segment feeding postponed hole P:4 via $RS("S:4","P:4")). This was safe pre-19.2 by ordering: each segment was consumed and removed synchronously by its own inline script before the next same-id segment parsed.
With batching, when the whole document is parsed in one burst (CDN cache hit / fast network / busy main thread delaying rAF), the parser executes $RS("S:4","P:4") while the shell's S:4 is still queued and in the DOM. completeSegment's returns the and moves the wrong subtree into the resume hole. The subsequent flush then operates on a cross-linked tree and throws: