1+ import type { ReactDOMServerReadableStream } from 'react-dom/server'
12import { getTracer } from '../lib/trace/tracer'
23import { AppRenderSpan } from '../lib/trace/constants'
34import { DetachedPromise } from '../../lib/detached-promise'
@@ -17,10 +18,6 @@ function voidCatch() {
1718 // and be unhandled
1819}
1920
20- export type ReactReadableStream = ReadableStream < Uint8Array > & {
21- allReady ?: Promise < void > | undefined
22- }
23-
2421// We can share the same encoder instance everywhere
2522// Notably we cannot do the same for TextDecoder because it is stateful
2623// when handling streaming data
@@ -221,7 +218,7 @@ export function renderToInitialFizzStream({
221218 }
222219 element : React . ReactElement
223220 streamOptions ?: Parameters < typeof ReactDOMServer . renderToReadableStream > [ 1 ]
224- } ) : Promise < ReactReadableStream > {
221+ } ) : Promise < ReactDOMServerReadableStream > {
225222 return getTracer ( ) . trace ( AppRenderSpan . renderToReadableStream , async ( ) =>
226223 ReactDOMServer . renderToReadableStream ( element , streamOptions )
227224 )
@@ -678,7 +675,7 @@ export type ContinueStreamOptions = {
678675}
679676
680677export async function continueFizzStream (
681- renderStream : ReactReadableStream ,
678+ renderStream : ReactDOMServerReadableStream ,
682679 {
683680 suffix,
684681 inlinedDataStream,
@@ -693,9 +690,8 @@ export async function continueFizzStream(
693690 // Suffix itself might contain close tags at the end, so we need to split it.
694691 const suffixUnclosed = suffix ? suffix . split ( CLOSE_TAG , 1 ) [ 0 ] : null
695692
696- // If we're generating static HTML and there's an `allReady` promise on the
697- // stream, we need to wait for it to resolve before continuing.
698- if ( isStaticGeneration && 'allReady' in renderStream ) {
693+ // If we're generating static HTML we need to wait for it to resolve before continuing.
694+ if ( isStaticGeneration ) {
699695 await renderStream . allReady
700696 }
701697
0 commit comments