Skip to content

fix(cdk/dialog): fall back to node injector token doesn't exist in template injector #25406

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

Merged
merged 1 commit into from
Aug 15, 2022

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Aug 6, 2022

In #24570 the template dialog was changed so that the dialog ref is resolved from the template injector, rather than the DOM. The problem is that existing logic for constructing the injector was reused which means that the lookup path for a token starting from inside the ng-template would be start -> node injector -> template injector -> app injector instead of start -> node injector -> template injector -> node injector -> app injector. This has caused some regressions for users of @angular/router like angular/angular#46500.

These changes resolve the issue by not providing a fallback injector so that the framework automatically falls back to the node injector.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Aug 6, 2022
@crisbeto crisbeto requested a review from jelbourn as a code owner August 6, 2022 07:48
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added the action: merge The PR is ready for merge by the caretaker label Aug 12, 2022
@johngrimsey
Copy link

Keen! 🙏

…mplate injector

In angular#24570 the template dialog was changed so that the dialog ref is resolved from the template injector, rather than the DOM. The problem is that existing logic for constructing the injector was reused which means that the lookup path for a token starting from inside the `ng-template` would be `start -> node injector -> template injector -> app injector` instead of `start -> node injector -> template injector -> node injector -> app injector`. This has caused some regressions for users of `@angular/router` like angular/angular#46500.

These changes resolve the issue by not providing a fallback injector so that the framework automatically falls back to the node injector.
@crisbeto crisbeto force-pushed the template-dialog-injector branch from 1082bf0 to 03f2f5b Compare August 15, 2022 05:28
@crisbeto crisbeto self-assigned this Aug 15, 2022
@crisbeto crisbeto merged commit 8027b5b into angular:main Aug 15, 2022
crisbeto added a commit that referenced this pull request Aug 15, 2022
…mplate injector (#25406)

In #24570 the template dialog was changed so that the dialog ref is resolved from the template injector, rather than the DOM. The problem is that existing logic for constructing the injector was reused which means that the lookup path for a token starting from inside the `ng-template` would be `start -> node injector -> template injector -> app injector` instead of `start -> node injector -> template injector -> node injector -> app injector`. This has caused some regressions for users of `@angular/router` like angular/angular#46500.

These changes resolve the issue by not providing a fallback injector so that the framework automatically falls back to the node injector.

(cherry picked from commit 8027b5b)
crisbeto added a commit that referenced this pull request Aug 15, 2022
…mplate injector (#25406)

In #24570 the template dialog was changed so that the dialog ref is resolved from the template injector, rather than the DOM. The problem is that existing logic for constructing the injector was reused which means that the lookup path for a token starting from inside the `ng-template` would be `start -> node injector -> template injector -> app injector` instead of `start -> node injector -> template injector -> node injector -> app injector`. This has caused some regressions for users of `@angular/router` like angular/angular#46500.

These changes resolve the issue by not providing a fallback injector so that the framework automatically falls back to the node injector.

(cherry picked from commit 8027b5b)
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Aug 23, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@angular/cdk](https://github.com/angular/components) | dependencies | patch | [`14.1.2` -> `14.1.3`](https://renovatebot.com/diffs/npm/@angular%2fcdk/14.1.2/14.1.3) |
| [@angular/material](https://github.com/angular/components) | dependencies | patch | [`14.1.2` -> `14.1.3`](https://renovatebot.com/diffs/npm/@angular%2fmaterial/14.1.2/14.1.3) |

---

### Release Notes

<details>
<summary>angular/components</summary>

### [`v14.1.3`](https://github.com/angular/components/blob/HEAD/CHANGELOG.md#&#8203;1413-rubber-chicken-2022-08-19)

[Compare Source](angular/components@14.1.2...14.1.3)

##### cdk

| Commit | Type | Description |
| -- | -- | -- |
| [f661a9300e](angular/components@f661a93) | fix | **dialog:** fall back to node injector token doesn't exist in template injector ([#&#8203;25406](angular/components#25406)) |
| [b9f09aa741](angular/components@b9f09aa) | fix | **overlay:** backdropClass type mismatch ([#&#8203;25487](angular/components#25487)) |

##### material

| Commit | Type | Description |
| -- | -- | -- |
| [d1ef7e23c6](angular/components@d1ef7e2) | fix | **button-toggle:** toggle name falling out of sync if name changes ([#&#8203;24713](angular/components#24713)) |
| [19df7cf940](angular/components@19df7cf) | fix | **expansion:** fix lint issue ([#&#8203;25469](angular/components#25469)) |

##### expansion

| Commit | Type | Description |
| -- | -- | -- |
| [b1450b1cb5](angular/components@b1450b1) | fix | fix expansion `.mat-expansion-panel-header` styles ([#&#8203;20019](angular/components#20019)) |

#### Special Thanks

Andrew Seguin, Dmitrii Kuzmin, Kristiyan Kostadinov, ko-tori and swseverance

<!-- CHANGELOG SPLIT MARKER -->

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzMi4xNjUuMSIsInVwZGF0ZWRJblZlciI6IjMyLjE2NS4xIn0=-->

Co-authored-by: cabr2-bot <[email protected]>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1515
Reviewed-by: Epsilon_02 <[email protected]>
Co-authored-by: Calciumdibromid Bot <[email protected]>
Co-committed-by: Calciumdibromid Bot <[email protected]>
@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 Sep 15, 2022
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 P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants