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(compiler-cli): handle default imports in defer blocks #53695

Closed
wants to merge 1 commit into from

Conversation

crisbeto
Copy link
Member

Fixes that @defer blocks weren't recognizing default imports and generating the proper code for them. Default symbols need to be accessed through the default property in the import statement, rather than by their name.

@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: compiler Issues related to `ngc`, Angular's template compiler labels Dec 25, 2023
@ngbot ngbot bot modified the milestone: Backlog Dec 25, 2023
return ts.isImportSpecifier(node) ? node.parent!.parent!.parent! :
ts.isNamespaceImport(node) ? node.parent.parent :
null;
let parent = node.parent;
Copy link
Member Author

Choose a reason for hiding this comment

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

I could've special-cased default imports here like we had it before, but I think that this is a bit more robust.

@crisbeto crisbeto marked this pull request as ready for review December 25, 2023 08:23
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the fix 👍

As discussed offline, we are marking this PR as blocked for now to land PR #53591, which refactors/moves those parts of the logic, so it'd be harder to rebase.

@AndrewKushnir AndrewKushnir added state: blocked and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 2, 2024
@crisbeto crisbeto added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: blocked labels Jan 31, 2024
@crisbeto
Copy link
Member Author

These changes should be unblocked now.

Fixes that `@defer` blocks weren't recognizing default imports and generating the proper code for them. Default symbols need to be accessed through the `default` property in the `import` statement, rather than by their name.
@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 1, 2024
jessicajaniuk pushed a commit that referenced this pull request Feb 1, 2024
Fixes that `@defer` blocks weren't recognizing default imports and generating the proper code for them. Default symbols need to be accessed through the `default` property in the `import` statement, rather than by their name.

PR Close #53695
@jessicajaniuk
Copy link
Contributor

This PR was merged into the repository by commit 95dcf5f.

JoostK added a commit to JoostK/angular that referenced this pull request Feb 18, 2024
…ls in defer blocks

This commit addresses a problem with PR angular#53695 that introduced support for default imports,
where the actual dynamic import used in the defer loading function continued to use the
symbol name, instead of `.default` for the dynamic import. This issue went unnoticed in the
testcase because a proper instance was being generated for the `ɵsetClassMetadataAsync` function,
but not the generated dependency loader function.

Fixes angular#54491
JoostK added a commit to JoostK/angular that referenced this pull request Feb 18, 2024
…ls in defer blocks

This commit addresses a problem with PR angular#53695 that introduced support for default imports,
where the actual dynamic import used in the defer loading function continued to use the
symbol name, instead of `.default` for the dynamic import. This issue went unnoticed in the
testcase because a proper instance was being generated for the `ɵsetClassMetadataAsync` function,
but not the generated dependency loader function.

Fixes angular#54491
alxhub pushed a commit that referenced this pull request Feb 20, 2024
…ls in defer blocks (#54495)

This commit addresses a problem with PR #53695 that introduced support for default imports,
where the actual dynamic import used in the defer loading function continued to use the
symbol name, instead of `.default` for the dynamic import. This issue went unnoticed in the
testcase because a proper instance was being generated for the `ɵsetClassMetadataAsync` function,
but not the generated dependency loader function.

Fixes #54491

PR Close #54495
alxhub pushed a commit that referenced this pull request Feb 20, 2024
…ls in defer blocks (#54495)

This commit addresses a problem with PR #53695 that introduced support for default imports,
where the actual dynamic import used in the defer loading function continued to use the
symbol name, instead of `.default` for the dynamic import. This issue went unnoticed in the
testcase because a proper instance was being generated for the `ɵsetClassMetadataAsync` function,
but not the generated dependency loader function.

Fixes #54491

PR Close #54495
@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 Mar 3, 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: 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.

None yet

3 participants