Skip to content

fix(compiler-cli): handle deferred blocks with shared dependencies correctly#59926

Closed
crisbeto wants to merge 1 commit intoangular:mainfrom
crisbeto:59922/dedupe-per-component-deps
Closed

fix(compiler-cli): handle deferred blocks with shared dependencies correctly#59926
crisbeto wants to merge 1 commit intoangular:mainfrom
crisbeto:59922/dedupe-per-component-deps

Conversation

@crisbeto
Copy link
Copy Markdown
Member

@crisbeto crisbeto commented Feb 12, 2025

When the compiler analyzes the defer blocks in a component, it generates two sets of dependencies: ones specific for each block and another from all the deferred blocks within the component. The logic that combines all the defer block dependencies wasn't de-duplicating them which resulted in us producing setClassMetadataAsync calls where the callback can have multiple parameters with the same name. This was a problem both in full and partial compilation, but the latter was more visible, because Babel throws an error in such cases.

These changes add some logic to de-duplicate the dependencies so that we produce valid code.

Fixes #59922.

…rrectly

When the compiler analyzes the defer blocks in a component, it generates two sets of dependencies: ones specific for each block and others from all the deferred blocks within the component. The logic that combines all the defer block dependencies wasn't de-duplicating them which resulted in us producing `setClassMetadataAsync` calls where the callback can have multiple parameters with the same name. This was a problem both in full and partial compilation, but the latter was more visible, because Babel throws an error in such cases.

These changes add some logic to de-duplicate the dependencies so that we produce valid code.

Fixes angular#59922.
@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 labels Feb 12, 2025
@angular-robot angular-robot bot added the area: compiler Issues related to `ngc`, Angular's template compiler label Feb 12, 2025
@ngbot ngbot bot added this to the Backlog milestone Feb 12, 2025
@crisbeto crisbeto requested a review from devversion February 12, 2025 14:15
@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 Feb 12, 2025
atscott pushed a commit that referenced this pull request Feb 12, 2025
…rrectly (#59926)

When the compiler analyzes the defer blocks in a component, it generates two sets of dependencies: ones specific for each block and others from all the deferred blocks within the component. The logic that combines all the defer block dependencies wasn't de-duplicating them which resulted in us producing `setClassMetadataAsync` calls where the callback can have multiple parameters with the same name. This was a problem both in full and partial compilation, but the latter was more visible, because Babel throws an error in such cases.

These changes add some logic to de-duplicate the dependencies so that we produce valid code.

Fixes #59922.

PR Close #59926
@atscott atscott closed this in 5cd26a9 Feb 12, 2025
@atscott
Copy link
Copy Markdown
Contributor

atscott commented Feb 12, 2025

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

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

@angular-automatic-lock-bot
Copy link
Copy Markdown

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 Mar 15, 2025
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: compiler Issues related to `ngc`, Angular's template compiler target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can not build Angular libraries with multiple defer blocks

3 participants