FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(compiler): ensure that partially compiled queries can handle forward references by petebacondarwin · Pull Request #44113 · angular/angular · GitHub

fix(compiler): ensure that partially compiled queries can handle forward references - #44113

Closed
petebacondarwin wants to merge 2 commits into
angular:masterfrom
petebacondarwin:linker-content-children-query-forward-ref-issue
Closed

fix(compiler): ensure that partially compiled queries can handle forward references#44113
petebacondarwin wants to merge 2 commits into
angular:masterfrom
petebacondarwin:linker-content-children-query-forward-ref-issue

Conversation

petebacondarwin commented Nov 8, 2021
edited
Loading

Copy link
Copy Markdown
Contributor

When a partially compiled component or directive is "linked" in JIT mode, the body
of its declaration is evaluated by the JavaScript runtime. If a class is referenced
in a query (e.g. ViewQuery or ContentQuery) but its definition is later in the
file, then the reference must be wrapped in a forwardRef() call.

Previously, query predicates were not wrapped correctly in partial declarations
causing the code to crash at runtime. In AOT mode, this code is never evaluated
but instead transformed as part of the build, so this bug did not become apparent
until Angular Material started running JIT mode tests on its distributable output.

This change fixes this problem by noting when queries are wrapped in forwardRef()
calls and ensuring that this gets passed through to partial compilation declarations
and then suitably stripped during linking.

See angular/components#23882 and angular/components#23907

Unfortunately, any libraries that were published before this gets merged will potentially have the problem going forward, if they have forwardRefs in their query definitions. The resolution it to simply build and release a new version. With that in mind, it might be worth landing this in 12.2.x LTS as well.

petebacondarwin 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 compiler: linker labels Nov 8, 2021
google-cla Bot added the cla: yes label Nov 8, 2021
ngbot Bot modified the milestone: Backlog Nov 8, 2021
petebacondarwin force-pushed the linker-content-children-query-forward-ref-issue branch 3 times, most recently from 7b5e12c to 949fca5 Compare November 8, 2021 14:21
petebacondarwin added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 8, 2021
This interface will be used in other situations so this change renames it to be more general as `MaybeForwardRefExpression`.
petebacondarwin force-pushed the linker-content-children-query-forward-ref-issue branch 2 times, most recently from 42c0b3d to 53a6df1 Compare November 9, 2021 08:15
petebacondarwin removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 9, 2021
petebacondarwin force-pushed the linker-content-children-query-forward-ref-issue branch from 53a6df1 to 9b9d0de Compare November 9, 2021 08:27
petebacondarwin added the action: presubmit The PR is in need of a google3 presubmit label Nov 9, 2021
petebacondarwin force-pushed the linker-content-children-query-forward-ref-issue branch from 9b9d0de to e03badd Compare November 9, 2021 08:29
petebacondarwin added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 9, 2021
petebacondarwin marked this pull request as draft November 9, 2021 08:53
petebacondarwin force-pushed the linker-content-children-query-forward-ref-issue branch from e03badd to 14b69b2 Compare November 9, 2021 09:01

JoostK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

In general LGTM, but I'm deferring for a full-pass review to @alxhub.

…ard references

When a partially compiled component or directive is "linked" in JIT mode, the body
of its declaration is evaluated by the JavaScript runtime. If a class is referenced
in a query (e.g. `ViewQuery` or `ContentQuery`) but its definition is later in the
file, then the reference must be wrapped in a `forwardRef()` call.

Previously, query predicates were not wrapped correctly in partial declarations
causing the code to crash at runtime. In AOT mode, this code is never evaluated
but instead transformed as part of the build, so this bug did not become apparent
until Angular Material started running JIT mode tests on its distributable output.

This change fixes this problem by noting when queries are wrapped in `forwardRef()`
calls and ensuring that this gets passed through to partial compilation declarations
and then suitably stripped during linking.

See angular/components#23882 and angular/components#23907
petebacondarwin force-pushed the linker-content-children-query-forward-ref-issue branch from f40e02c to c0ad276 Compare November 10, 2021 14:57

atscott commented Nov 10, 2021

Copy link
Copy Markdown
Contributor

presubmit

atscott 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 action: presubmit The PR is in need of a google3 presubmit labels Nov 10, 2021

ngbot Bot commented Nov 10, 2021

Copy link
Copy Markdown

I see that you just added the action: merge label, but the following checks are still failing:
     status "ci/circleci: legacy-unit-tests-saucelabs" is failing
     1 pending code review

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

atscott commented Nov 10, 2021

Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit 393efa5.

atscott pushed a commit that referenced this pull request Nov 10, 2021
#44113)

This interface will be used in other situations so this change renames it to be more general as `MaybeForwardRefExpression`.

PR Close #44113
atscott pushed a commit that referenced this pull request Nov 10, 2021
…ard references (#44113)

When a partially compiled component or directive is "linked" in JIT mode, the body
of its declaration is evaluated by the JavaScript runtime. If a class is referenced
in a query (e.g. `ViewQuery` or `ContentQuery`) but its definition is later in the
file, then the reference must be wrapped in a `forwardRef()` call.

Previously, query predicates were not wrapped correctly in partial declarations
causing the code to crash at runtime. In AOT mode, this code is never evaluated
but instead transformed as part of the build, so this bug did not become apparent
until Angular Material started running JIT mode tests on its distributable output.

This change fixes this problem by noting when queries are wrapped in `forwardRef()`
calls and ensuring that this gets passed through to partial compilation declarations
and then suitably stripped during linking.

See angular/components#23882 and angular/components#23907

PR Close #44113
atscott closed this in 67fbec3 Nov 10, 2021
atscott pushed a commit that referenced this pull request Nov 10, 2021
…ard references (#44113)

When a partially compiled component or directive is "linked" in JIT mode, the body
of its declaration is evaluated by the JavaScript runtime. If a class is referenced
in a query (e.g. `ViewQuery` or `ContentQuery`) but its definition is later in the
file, then the reference must be wrapped in a `forwardRef()` call.

Previously, query predicates were not wrapped correctly in partial declarations
causing the code to crash at runtime. In AOT mode, this code is never evaluated
but instead transformed as part of the build, so this bug did not become apparent
until Angular Material started running JIT mode tests on its distributable output.

This change fixes this problem by noting when queries are wrapped in `forwardRef()`
calls and ensuring that this gets passed through to partial compilation declarations
and then suitably stripped during linking.

See angular/components#23882 and angular/components#23907

PR Close #44113
devversion added a commit to devversion/material2 that referenced this pull request Nov 11, 2021
…lation output

We updated to Angular v13.0.1 which fixes the partial compilation output
for `forwardRef` usages in queries. The fixed partial compilation output
will ensure that Angular CDK/Material works with JIT linking at runtime,
as done in e.g. Jest.

Fix upstream: angular/angular#44113.

We will add some testing for the JIT linker to the `angular/components`
repository with: angular#23882. That
should help ensuring JIT linking does not regress.

Fixes angular#23907.
devversion added a commit to devversion/material2 that referenced this pull request Nov 11, 2021
…lation output

Updates to Angular v13.0.1 which fixes the partial compilation output
for `forwardRef` usages in queries. The fixed partial compilation output
will ensure that Angular CDK/Material works with JIT linking at runtime,
as done in e.g. Jest.

Fix upstream: angular/angular#44113.

We will add some testing for the JIT linker to the `angular/components`
repository with: angular#23882. That
should help ensuring JIT linking does not regress.

Fixes angular#23907.
amysorto pushed a commit to angular/components that referenced this pull request Nov 11, 2021
…lation output (#23951)

Updates to Angular v13.0.1 which fixes the partial compilation output
for `forwardRef` usages in queries. The fixed partial compilation output
will ensure that Angular CDK/Material works with JIT linking at runtime,
as done in e.g. Jest.

Fix upstream: angular/angular#44113.

We will add some testing for the JIT linker to the `angular/components`
repository with: #23882. That
should help ensuring JIT linking does not regress.

Fixes #23907.
amysorto pushed a commit to angular/components that referenced this pull request Nov 11, 2021
…lation output (#23951)

Updates to Angular v13.0.1 which fixes the partial compilation output
for `forwardRef` usages in queries. The fixed partial compilation output
will ensure that Angular CDK/Material works with JIT linking at runtime,
as done in e.g. Jest.

Fix upstream: angular/angular#44113.

We will add some testing for the JIT linker to the `angular/components`
repository with: #23882. That
should help ensuring JIT linking does not regress.

Fixes #23907.

(cherry picked from commit 8cb0f12)
petebacondarwin deleted the linker-content-children-query-forward-ref-issue branch November 12, 2021 14:32
crisbeto added a commit to crisbeto/material.angular.io that referenced this pull request Nov 19, 2021
We're currently locked into version 13.0.0 which has a problem with queries using `forwardRef` which affects several places in the docs like the navigation between docs and API examples.

These changes update to 13.0.1 which contains angular/angular#44113 in order to resolve the issue.
crisbeto added a commit to angular/material.angular.io that referenced this pull request Nov 19, 2021
We're currently locked into version 13.0.0 which has a problem with queries using `forwardRef` which affects several places in the docs like the navigation between docs and API examples.

These changes update to 13.0.1 which contains angular/angular#44113 in order to resolve the issue.

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 Bot locked and limited conversation to collaborators Dec 13, 2021
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 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 cla: yes compiler: linker target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants


Back | FazBrowse Home | New Git URL