-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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(migrations): account for variables in imports initializer #55081
Conversation
Fixes that the control flow migration was throwing an error if the `imports` of a component are initialized to an identifier. Fixes angular#55080.
`const BEFORE = [];\n`, | ||
`const AFTER = [];\n`, | ||
`@Component({`, | ||
` imports: [...BEFORE, ...AFTER],`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I wonder if it is safe to remove the CommonModule
here - what happens if someone uses non-control-flow dependencies from that module? Are we verifying this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jessicajaniuk should know more about it, I just took one of the existing tests and tweaked it to cover the case from #55080.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we are already looking at symbols used from common module in the component file and the template. So we do know if it's safe to remove at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thnx for confirming @jessicajaniuk !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for adding this!
`const BEFORE = [];\n`, | ||
`const AFTER = [];\n`, | ||
`@Component({`, | ||
` imports: [...BEFORE, ...AFTER],`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we are already looking at symbols used from common module in the component file and the template. So we do know if it's safe to remove at this point.
This PR was merged into the repository by commit 6368871. |
…r#55081) Fixes that the control flow migration was throwing an error if the `imports` of a component are initialized to an identifier. Fixes angular#55080. PR Close angular#55081
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes that the control flow migration was throwing an error if the
imports
of a component are initialized to an identifier.Fixes #55080.