Skip to content

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

Merged
vicb merged 2 commits into
mainfrom
transform
Dec 3, 2024
Merged

refactor: move StreamCreator to types/open-next#663
vicb merged 2 commits into
mainfrom
transform

Conversation

@vicb

@vicb vicb commented Dec 3, 2024

Copy link
Copy Markdown
Contributor

And make onFinish optional


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

@changeset-bot

changeset-bot Bot commented Dec 3, 2024

Copy link
Copy Markdown

🦋 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

@pkg-pr-new

pkg-pr-new Bot commented Dec 3, 2024

Copy link
Copy Markdown

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
Copy Markdown
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?

@github-actions

github-actions Bot commented Dec 3, 2024

Copy link
Copy Markdown
Contributor

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

@conico974 conico974 left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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!

@conico974 conico974 left a comment

Copy link
Copy Markdown
Contributor

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
@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