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

refactor: move StreamCreator to types/open-next #663

Merged
merged 2 commits into from
Dec 3, 2024
Merged

refactor: move StreamCreator to types/open-next #663

merged 2 commits into from
Dec 3, 2024

Conversation

vicb
Copy link
Contributor

@vicb vicb commented Dec 3, 2024

And make onFinish optional


This is part 1 of 2 in a stack made with GitButler:

Copy link

changeset-bot bot commented Dec 3, 2024

🦋 Changeset detected

Latest commit: 5eb848f

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

This PR includes changesets to release 3 packages
Name Type
@opennextjs/aws 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

pkg-pr-new bot commented Dec 3, 2024

Open in Stackblitz

pnpm add https://pkg.pr.new/@opennextjs/aws@663

commit: 5eb848f

@vicb vicb requested a review from conico974 December 3, 2024 12:34
return Boolean(
this.writableFinished && this.responseStream?.writableFinished,
);
return this.writableFinished && (this.responseStream?.writableFinished ?? true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a change in behavior but I believe this is what we want?

Copy link
Contributor

github-actions bot commented Dec 3, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 22.94% 1723 / 7510
🔵 Statements 22.94% 1723 / 7510
🔵 Functions 56.59% 103 / 182
🔵 Branches 71% 436 / 614
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/open-next/src/adapters/image-optimization-adapter.ts 0% 0% 0% 0% 1-274
packages/open-next/src/core/requestHandler.ts 0% 0% 0% 0% 1-240
packages/open-next/src/core/routing/util.ts 89.43% 86.66% 95% 89.43% 205-206, 275-277, 292, 404-425
packages/open-next/src/http/openNextResponse.ts 1.48% 0% 0% 1.48% 20-393
packages/open-next/src/overrides/wrappers/aws-lambda-streaming.ts 0% 0% 0% 0% 1-118
packages/open-next/src/overrides/wrappers/aws-lambda.ts 0% 0% 0% 0% 1-73
packages/open-next/src/overrides/wrappers/cloudflare-node.ts 0% 0% 0% 0% 1-73
packages/open-next/src/overrides/wrappers/node.ts 0% 0% 0% 0% 1-66
packages/open-next/src/types/open-next.ts 0% 0% 0% 0%
packages/open-next/src/types/overrides.ts 0% 0% 0% 0%
Generated in workflow #806 for commit 5eb848f by the Vitest Coverage Report Action

Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

Not sure about the finished() change. The rest is good

return Boolean(
this.writableFinished && this.responseStream?.writableFinished,
return (
this.writableFinished && (this.responseStream?.writableFinished ?? true)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this one is correct actually.
Your fix is good in case we don't provide a ResponseStream, but in case we do, we may end up in a situation where OpenNextNodeResponse is finished, but not this.responseStream. I'm not 100% sure of that though and not sure what could be the consequences either.

I think we could replace it with

this.responseStream ? this.responseStream.writableFinished : this.writableFinished

Copy link
Contributor Author

Choose a reason for hiding this comment

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

swapped for your suggestion, thanks!

Copy link
Contributor

@conico974 conico974 left a comment

Choose a reason for hiding this comment

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

LGTM Thanks

@vicb vicb merged commit 4d328e3 into main Dec 3, 2024
3 checks passed
@vicb vicb deleted the transform branch December 3, 2024 13:10
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