diff --git a/.changeset/lovely-ways-smoke.md b/.changeset/lovely-ways-smoke.md new file mode 100644 index 00000000..8f0012f2 --- /dev/null +++ b/.changeset/lovely-ways-smoke.md @@ -0,0 +1,5 @@ +--- +'preact-render-to-string': patch +--- + +Fix issues regarding streaming full HTML documents diff --git a/src/lib/chunked.js b/src/lib/chunked.js index cd1686d1..48aca958 100644 --- a/src/lib/chunked.js +++ b/src/lib/chunked.js @@ -23,19 +23,41 @@ export async function renderToChunks(vnode, { context, onWrite, abortSignal }) { // Synchronously render the shell // @ts-ignore - using third internal RendererState argument const shell = renderToString(vnode, context, renderer); - onWrite(shell); // Wait for any suspended sub-trees if there are any const len = renderer.suspended.length; if (len > 0) { + // When rendering a full HTML document, the shell ends with . + // Inserting the deferred