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(zone.js): zone-node only patch Promise.prototype.then #49144

Closed
wants to merge 1 commit into from

Conversation

JiaLiPassion
Copy link
Contributor

@JiaLiPassion JiaLiPassion commented Feb 20, 2023

Close #47872

zone-node only patches Promise.prototype.then instead of patch
Promise itself. So the new NodeJS SafePromise will not complain
the Promise.prototype.then called on incompatible receiver.

We should also do this change on browser zone.js patch, but it will
be a big breaking change, because Promise.prototype.then will not work
with fakeAsync any longer.

Copy link
Contributor

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

LGTM, confirmed that this solved the issue.

@alan-agius4 alan-agius4 added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Feb 21, 2023
@JiaLiPassion JiaLiPassion requested review from alxhub and removed request for josephperrott February 21, 2023 13:02
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Feb 21, 2023
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

@JiaLiPassion thanks for the fix 👍

I've left a couple minor comments and I also have a question (just to double check): would that version work correctly with the NodeJS version range that we have for Angular apps (starting from v15.2)?

(we can also update the feat(zone.js) -> fix(zone.js), so that we can land this change sooner than v16)

packages/zone.js/lib/node/promise.ts Show resolved Hide resolved
packages/zone.js/lib/node/promise.ts Outdated Show resolved Hide resolved
Close angular#47872

zone-node only patches `Promise.prototype.then` instead of patch
`Promise` itself. So the new NodeJS `SafePromise` will not complain
the Promise.prototype.then called on incompatible receiver.

We should also do this change on browser zone.js patch, but it will
be a big breaking change, because Promise.prototype.then will not work
with `fakeAsync` any longer.
@JiaLiPassion
Copy link
Contributor Author

@AndrewKushnir, thank you for the review, I have updated the code and also the git comment for the commit.

@angular-robot angular-robot bot removed the detected: feature PR contains a feature commit label Feb 21, 2023
@AndrewKushnir AndrewKushnir changed the title feat(zone.js): zone-node only patch Promise.prototype.then fix(zone.js): zone-node only patch Promise.prototype.then Feb 22, 2023
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the feedback @JiaLiPassion 👍

@AndrewKushnir AndrewKushnir added action: presubmit The PR is in need of a google3 presubmit target: patch This PR is targeted for the next patch release and removed action: review The PR is still awaiting reviews from at least one requested reviewer target: minor This PR is targeted for the next minor release labels Feb 22, 2023
@AndrewKushnir
Copy link
Contributor

AndrewKushnir commented Feb 22, 2023

Presubmit (+ TGP).

@AndrewKushnir
Copy link
Contributor

Caretaker note: this CL contains an updated patch for g3.

@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Feb 24, 2023
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed action: review The PR is still awaiting reviews from at least one requested reviewer action: presubmit The PR is in need of a google3 presubmit labels Feb 24, 2023
@AndrewKushnir AndrewKushnir added target: minor This PR is targeted for the next minor release and removed target: patch This PR is targeted for the next patch release labels Feb 27, 2023
@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit d1ac3aa.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: zones merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[zone.js] Node > 16.17.1: Method Promise.prototype.then called on incompatible receiver
5 participants