react icon indicating copy to clipboard operation
react copied to clipboard

Bug: `progressiveChunkSize` forcing streaming SSR breaks html file integrity and `onAllReady` behavior

Open SoonIter opened this issue 1 month ago • 0 comments

React version: 19.2.0

Steps To Reproduce

// App.tsx
<div className="rp-doc rspress-doc">
  <Suspense>
    <MyComp />
  </Suspense>
</div>
function renderToHtml(app: ReactNode): Promise<string> {
  return new Promise((resolve, reject) => {
    const passThrough = new PassThrough();
    const { pipe } = renderToPipeableStream(app, {
      onError(error) {
        reject(error);
      },
      onAllReady() {
        pipe(passThrough);
        text(passThrough).then(resolve, reject);
      },
    });
  });
}

related APIs:

renderToPipeableStream prerenderToNodeStream etc

react 19.1.1

<main class="rp-doc-layout__doc-container">
  <div class="rp-doc rspress-doc">
     <h1>title</h1>
   </div>
</main>

.rspress-doc > h1 works fine

react 19.2.0

If the article content is very long, it exceeds the chunkSize set by React.

<main class="rp-doc-layout__doc-container">
  <div class="rp-doc rspress-doc"><!--$?--><template id="B:0"></template><!--/$--></div>
</main>

<script>requestAnimationFrame(function () { $RT = performance.now() });</script>
<div hidden id="S:0">
  <h1>title</h1>
</div>

.rspress-doc > h1 🤕

Related links

  • https://github.com/web-infra-dev/rspress/pull/2831

  • https://github.com/facebook/react/pull/33027

  • https://github.com/facebook/react/pull/33027#issuecomment-3403958008

The current behavior

onAllReady returns a HTML with streaming rendering

The expected behavior

onAllReady behavior as the same as React 19.1.1

SoonIter avatar Dec 03 '25 03:12 SoonIter