Skip to content

Commit

Permalink
fix: re-apply workaround for injectToStream() at stream end race cond…
Browse files Browse the repository at this point in the history
…ition (#40)

This reverts commit 19aec51.
  • Loading branch information
brillout committed Jul 1, 2024
1 parent e079cf9 commit f43bd9b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/server/renderToStream/createReadableWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down

0 comments on commit f43bd9b

Please sign in to comment.