Skip to content

refactor(migrations): signal input migration, use input() shorthand and always add readonly modifier#57368

Closed
devversion wants to merge 2 commits intoangular:mainfrom
devversion:signal-input-migration
Closed

refactor(migrations): signal input migration, use input() shorthand and always add readonly modifier#57368
devversion wants to merge 2 commits intoangular:mainfrom
devversion:signal-input-migration

Conversation

@devversion
Copy link
Member

See individual commits

…gration

In some cases, the migration can detect when `input()` as a shorthand
may be usable. This commit adds such detection and migrates inputs to
this form when possible.
@angular-robot angular-robot bot added the area: migrations Issues related to `ng update`/`ng generate` migrations label Aug 13, 2024
@ngbot ngbot bot added this to the Backlog milestone Aug 13, 2024
Signal inputs are no longer updated by assignment, unlike `@Input()`, so
a good practice is adding `readonly` for the `InputSignal`— which should
never be swapped out.

This is a safe operation because the migration skips all inputs that are
being written anyway.
@devversion devversion force-pushed the signal-input-migration branch from 49fccf7 to e8df2ea Compare August 13, 2024 11:31
@devversion devversion requested a review from crisbeto August 13, 2024 13:06
@devversion devversion added target: rc This PR is targeted for the next release-candidate action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 13, 2024
@devversion devversion marked this pull request as ready for review August 13, 2024 13:06
protected readonly ImProtected = input(true);
protected readonly ImProtectedAndReadonly = input(true);
@CustomDecorator()
protected readonly usingCustomDecorator = input(true);
Copy link
Member Author

Choose a reason for hiding this comment

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

It didn't feel worth bothering about this formatting here; most code is auto-formatted anyway and doesn't use custom decorators.

@devversion devversion added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 13, 2024
@AndrewKushnir
Copy link
Contributor

This PR was merged into the repository by commit 74f0cb7.

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

AndrewKushnir pushed a commit that referenced this pull request Aug 13, 2024
…gration (#57368)

In some cases, the migration can detect when `input()` as a shorthand
may be usable. This commit adds such detection and migrates inputs to
this form when possible.

PR Close #57368
AndrewKushnir pushed a commit that referenced this pull request Aug 13, 2024
…#57368)

Signal inputs are no longer updated by assignment, unlike `@Input()`, so
a good practice is adding `readonly` for the `InputSignal`— which should
never be swapped out.

This is a safe operation because the migration skips all inputs that are
being written anyway.

PR Close #57368
AndrewKushnir pushed a commit that referenced this pull request Aug 13, 2024
…#57368)

Signal inputs are no longer updated by assignment, unlike `@Input()`, so
a good practice is adding `readonly` for the `InputSignal`— which should
never be swapped out.

This is a safe operation because the migration skips all inputs that are
being written anyway.

PR Close #57368
@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 Sep 13, 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: migrations Issues related to `ng update`/`ng generate` migrations target: rc This PR is targeted for the next release-candidate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants