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(migrations): account for variables in imports initializer #55081

Closed

Conversation

crisbeto
Copy link
Member

Fixes that the control flow migration was throwing an error if the imports of a component are initialized to an identifier.

Fixes #55080.

Fixes that the control flow migration was throwing an error if the `imports` of a component are initialized to an identifier.

Fixes angular#55080.
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release area: migrations Issues related to `ng update` migrations labels Mar 28, 2024
@ngbot ngbot bot added this to the Backlog milestone Mar 28, 2024
`const BEFORE = [];\n`,
`const AFTER = [];\n`,
`@Component({`,
` imports: [...BEFORE, ...AFTER],`,

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

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 !

Copy link
Contributor

@jessicajaniuk jessicajaniuk left a 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],`,
Copy link
Contributor

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.

@crisbeto crisbeto 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 Mar 28, 2024
@dylhunn
Copy link
Contributor

dylhunn commented Mar 28, 2024

This PR was merged into the repository by commit 6368871.

@dylhunn dylhunn closed this in 6368871 Mar 28, 2024
dylhunn pushed a commit that referenced this pull request Mar 28, 2024
Fixes that the control flow migration was throwing an error if the `imports` of a component are initialized to an identifier.

Fixes #55080.

PR Close #55081
ilirbeqirii pushed a commit to ilirbeqirii/angular that referenced this pull request Apr 6, 2024
…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
@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 Apr 28, 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` migrations target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generate @angular/core:control-flow failed
4 participants