Skip to content

Conversation

@alxhub
Copy link
Member

@alxhub alxhub commented Jul 17, 2024

@angular/upgrade writes to inputs when downgrading an Angular 2+ component into an Angular.JS adapter. Previously, it wrote directly to the input property, which isn't compatible with input signals. It also handles ngOnChanges directly.

The correct way to support input signals would be to refactor upgrade to use ComponentRef.setInput, which also handles ngOnChanges internally. However, this refactoring might be more breaking since it would change the timing of certain operations. Instead, this commit updates the code to recognize InputSignal and write it through the InputSignalNode. This avoids the above breaking changes for now, until a bigger refactoring can be tested.

Fixes #56860.

@alxhub alxhub added target: patch This PR is targeted for the next patch release area: upgrade Issues related to AngularJS → Angular upgrade APIs cross-cutting: signals labels Jul 17, 2024
@ngbot ngbot bot modified the milestone: Backlog Jul 17, 2024
@pullapprove pullapprove bot requested review from ehlemur July 17, 2024 14:20
@pullapprove pullapprove bot added requires: TGP This PR requires a passing TGP before merging is allowed labels Jul 17, 2024
Copy link
Member

@pkozlowski-opensource pkozlowski-opensource left a comment

Choose a reason for hiding this comment

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

LGTM

Reviewed-for: public-api
Reviewed-for: fw-core

@pullapprove pullapprove bot requested a review from thePunderWoman July 18, 2024 09:06
@pkozlowski-opensource pkozlowski-opensource 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 Jul 18, 2024
@pkozlowski-opensource
Copy link
Member

Adding the cleanup label as G3 is upset about dependencies (see presubmit)

Copy link
Contributor

@thePunderWoman thePunderWoman left a comment

Choose a reason for hiding this comment

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

reviewed-for: public-api, primitives

@alxhub alxhub removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Sep 24, 2024
@alxhub alxhub force-pushed the signal-upgrade branch 3 times, most recently from 86497ef to dcc063a Compare September 24, 2024 23:20
@pullapprove pullapprove bot removed the requires: TGP This PR requires a passing TGP before merging is allowed label Sep 24, 2024
`@angular/upgrade` writes to inputs when downgrading an Angular 2+ component
into an Angular.JS adapter. Previously, it wrote directly to the input
property, which isn't compatible with input signals. It also handles
`ngOnChanges` directly.

The correct way to support input signals would be to refactor upgrade to use
`ComponentRef.setInput`, which also handles `ngOnChanges` internally.
However, this refactoring might be more breaking since it would change the
timing of certain operations. Instead, this commit updates the code to
recognize `InputSignal` and write it through the `InputSignalNode`. This
avoids the above breaking changes for now, until a bigger refactoring can be
tested.

Fixes angular#56860.
@alxhub alxhub added the action: merge The PR is ready for merge by the caretaker label Sep 26, 2024
@ngbot
Copy link

ngbot bot commented Sep 26, 2024

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "google-internal-tests" is failing
    pending 3 pending code reviews

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken main, please try rebasing to main and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@alxhub alxhub added the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Sep 26, 2024
@alxhub
Copy link
Member Author

alxhub commented Sep 26, 2024

Caretaker (that's me, talking to myself here): this change is passing in g3 - there was 1 failing test which was fixed on the upstream end

@alxhub
Copy link
Member Author

alxhub commented Sep 26, 2024

This PR was merged into the repository by commit 5f56a65.

The changes were merged into the following branches: main, 18.2.x

alxhub added a commit that referenced this pull request Sep 26, 2024
`@angular/upgrade` writes to inputs when downgrading an Angular 2+ component
into an Angular.JS adapter. Previously, it wrote directly to the input
property, which isn't compatible with input signals. It also handles
`ngOnChanges` directly.

The correct way to support input signals would be to refactor upgrade to use
`ComponentRef.setInput`, which also handles `ngOnChanges` internally.
However, this refactoring might be more breaking since it would change the
timing of certain operations. Instead, this commit updates the code to
recognize `InputSignal` and write it through the `InputSignalNode`. This
avoids the above breaking changes for now, until a bigger refactoring can be
tested.

Fixes #56860.

PR Close #57020
@alxhub alxhub closed this in 5f56a65 Sep 26, 2024
@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 Oct 27, 2024
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: upgrade Issues related to AngularJS → Angular upgrade APIs cross-cutting: signals merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signal inputs do not work with upgrade package

4 participants