Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stream): flush enqueued entries on every pull on direct streams #10249

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lithdew
Copy link
Contributor

@lithdew lithdew commented Apr 13, 2024

What does this PR do?

Direct streams only flush their enqueued entries either 1) on close or 2) when the ReadableStreamController requests a flush. Libraries such as react-dom/server assume entries enqueued during a ReadableStreamController.pull() are flushed at times other than when the stream is closed.

To remedy this, we flush all enqueued entries in a direct stream at the end of a pull() invocation.

Fixes #7321.
Fixes #5664.

  • Documentation or TypeScript types (it's okay to leave the rest blank in this case)
  • Code changes

How did you verify your code works?

  • I included a test for the new code, or existing tests cover it
  • I ran my tests locally and they pass (bun-debug test test-file-name.test)

@Jarred-Sumner
Copy link
Collaborator

The other thing about this approach is it would only impact new Response(stream).arrayBuffer, new Response(stream).text. It would not impact the HTTP server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants