diff --git a/src/server/renderToStream/createReadableWrapper.ts b/src/server/renderToStream/createReadableWrapper.ts index 490dc3d..43d23fe 100644 --- a/src/server/renderToStream/createReadableWrapper.ts +++ b/src/server/renderToStream/createReadableWrapper.ts @@ -52,9 +52,12 @@ function createReadableWrapper(readableFromReact: ReadableStream, { stopTimeout stopTimeout?.() - onBeforeEnd() - controllerOfUserStream.close() - onEnded() + // Collect `injectToStream()` calls stuck in an async call + setTimeout(() => { + onBeforeEnd() + controllerOfUserStream.close() + onEnded() + }, 0) } }