Skip to content

Conversation

conico974
Copy link
Contributor

This PR change the body of InternalResult from string to ReadableStream.
This allow for edge runtime function to use streaming, and it is necessary to prepare for PPR.

This should also remove the need to add a fakeStream in non streaming wrapper as the stream is now always consumed if you return a body.

Copy link

changeset-bot bot commented Aug 6, 2024

🦋 Changeset detected

Latest commit: 38a5df6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
open-next Minor
app-pages-router Patch
app-router Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Aug 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
open-next ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 21, 2024 11:51am

Copy link
Contributor

@khuezy khuezy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just 1 comment, otherwise my tiny grain of salt LGTM


export function emptyReadableStream(): ReadableStream {
if (process.env.OPEN_NEXT_FORCE_NON_EMPTY_RESPONSE === "true") {
return Readable.toWeb(Readable.from(["SOMETHING"]));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be an empty string or does it have to be a non-empty string?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Empty string didn't work, we could have used new Uint8Array(8) but since it is used as a delimiter for the header part of the string i fear that this could introduce other issue later ( being misinterpreted by the streaming server )

@conico974 conico974 merged commit b88ae13 into opennextjs:main Aug 21, 2024
@conico974 conico974 deleted the feat/readable-body branch October 29, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants