fix(core): improve input writes migration in best effort mode#68638
Open
tmpln wants to merge 1 commit into
Open
fix(core): improve input writes migration in best effort mode#68638tmpln wants to merge 1 commit into
tmpln wants to merge 1 commit into
Conversation
Currently, signal migration schematics in best effort mode doesn't do a very good job migrating input writes when there is a nested property access in templates. In event handlers, no attempt is made to migrate a nested access in the left-hand-side of assignments or anything in their right-hand-side. E.g., nothing will happen here: `(ngModelChange)="inputD.prop = $event + inputF"`. Additionally, when a migration attempt is made, parentheses are often incorrectly placed on the parent, both in event handlers and two-way bindings: `(ngModelChange)="inputC = $event"` is migrated to `(ngModelChange)="inputC = $event()"`. `[(ngModel)]="inputB.prop.prop"` is migrated to `[(ngModel)]="inputB.prop().prop"`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, signal migration schematics in best effort mode doesn't do a very good job migrating input writes when there is a nested property access in templates.
In event handlers, no attempt is made to migrate a nested access in the left-hand-side of assignments or anything in their right-hand-side. E.g., nothing will happen here:
(ngModelChange)="inputD.prop = $event + inputF".Additionally, when a migration attempt is made, parentheses are often incorrectly placed on the parent, both in event handlers and two-way bindings:
(ngModelChange)="inputC = $event"is migrated to(ngModelChange)="inputC = $event()".[(ngModel)]="inputB.prop.prop"is migrated to[(ngModel)]="inputB.prop().prop".PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The following line is not updated during migration:
(ngModelChange)="inputD.prop = $event + inputF".This:
(ngModelChange)="inputC = $event"is migrated to:(ngModelChange)="inputC = $event()".This:
[(ngModel)]="inputB.prop.prop"is migrated to:[(ngModel)]="inputB.prop().prop".What is the new behavior?
This:
(ngModelChange)="inputD.prop = $event + inputF"is migrated to:(ngModelChange)="inputD().prop = $event + inputF()".This:
(ngModelChange)="inputC = $event"is migrated to:(ngModelChange)="inputC() = $event".This:
[(ngModel)]="inputB.prop.prop"is migrated to:[(ngModel)]="inputB().prop.prop".Does this PR introduce a breaking change?
Other information
N/A