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(cdk/overlay): detach overlay when portal is destroyed from the outside #25212

Merged
merged 1 commit into from
Jul 20, 2022

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Jul 2, 2022

Fixes that some of the overlay elements were left behind when the portal is destroyed without going through the overlay API. We need to handle this case, because in many cases users don't have access to the OverlayRef (e.g. MatDialog) so that they can call dispose themselves.

Fixes #25163.

@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 Jul 2, 2022
@crisbeto crisbeto requested a review from jelbourn as a code owner July 2, 2022 10:20
@crisbeto crisbeto force-pushed the 25163/overlay-destroy-detach branch from 3ec69f9 to 079dc22 Compare July 2, 2022 10:25
src/cdk/overlay/overlay-ref.ts Outdated Show resolved Hide resolved
src/cdk/overlay/overlay-ref.ts Outdated Show resolved Hide resolved
@crisbeto crisbeto force-pushed the 25163/overlay-destroy-detach branch from 079dc22 to fe7a7a0 Compare July 12, 2022 04:42
@crisbeto
Copy link
Member Author

The feedback has been addressed.

Copy link
Contributor

@andrewseguin andrewseguin left a comment

Choose a reason for hiding this comment

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

Curious to see if this requires any test timing updates internally

@andrewseguin andrewseguin added the action: merge The PR is ready for merge by the caretaker label Jul 19, 2022
@crisbeto crisbeto self-assigned this Jul 19, 2022
…tside

Fixes that some of the overlay elements were left behind when the portal is destroyed without going through the overlay API. We need to handle this case, because in many cases users don't have access to the `OverlayRef` (e.g. `MatDialog`) so that they can call `dispose` themselves.

Fixes angular#25163.
@crisbeto crisbeto force-pushed the 25163/overlay-destroy-detach branch from fe7a7a0 to 0d0e0e5 Compare July 20, 2022 07:29
crisbeto added a commit to crisbeto/angular that referenced this pull request Jul 20, 2022
@crisbeto crisbeto merged commit 627daf9 into angular:main Jul 20, 2022
crisbeto added a commit that referenced this pull request Jul 20, 2022
…tside (#25212)

Fixes that some of the overlay elements were left behind when the portal is destroyed without going through the overlay API. We need to handle this case, because in many cases users don't have access to the `OverlayRef` (e.g. `MatDialog`) so that they can call `dispose` themselves.

Fixes #25163.

(cherry picked from commit 627daf9)
crisbeto added a commit to crisbeto/angular that referenced this pull request Jul 23, 2022
…ViewRef

The value returned from `ViewContainerRef.createEmbeddedView` matches the `EmbeddedViewRef` interface, but it isn't an instance of the class that is exposed publicly. This can cause bugs, because the `instanceof` checks can be used for type narrowing, e.g. I got tripped up by it in  angular/components#25212.

These changes switch to extending the publicly-exposed class and adding a couple of tests to avoid regressions.
crisbeto added a commit to crisbeto/angular that referenced this pull request Jul 23, 2022
…ViewRef

The value returned from `ViewContainerRef.createEmbeddedView` matches the `EmbeddedViewRef` interface, but it isn't an instance of the class that is exposed publicly. This can cause bugs, because the `instanceof` checks can be used for type narrowing, e.g. I got tripped up by it in  angular/components#25212.

These changes switch to extending the publicly-exposed class and adding a couple of tests to avoid regressions.
crapStone pushed a commit to Calciumdibromid/CaBr2 that referenced this pull request Aug 9, 2022
This PR contains the following updates:

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

---

### Release Notes

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

### [`v14.1.1`](https://github.com/angular/components/blob/HEAD/CHANGELOG.md#&#8203;1411-moissanite-mango-2022-08-03)

[Compare Source](angular/components@14.1.0...14.1.1)

##### cdk

| Commit | Type | Description |
| -- | -- | -- |
| [251c9abdf](angular/components@251c9ab) | fix | **dialog:** use config injector if provided ([#&#8203;25332](angular/components#25332)) |
| [636dd60ee](angular/components@636dd60) | fix | **drag-drop:** expose pickup position in constrainPosition callback ([#&#8203;25341](angular/components#25341)) |
| [aea1a5d67](angular/components@aea1a5d) | fix | **overlay:** detach overlay when portal is destroyed from the outside ([#&#8203;25212](angular/components#25212)) |
| [63ca33bc8](angular/components@63ca33b) | fix | **schematics:** strip bom from sass files ([#&#8203;25364](angular/components#25364)) |

##### material-experimental

| Commit | Type | Description |
| -- | -- | -- |
| [e045e8d49](angular/components@e045e8d) | fix | **mdc-chips:** don't use button element if chip row isn't editable ([#&#8203;25327](angular/components#25327)) |
| [394b93f18](angular/components@394b93f) | fix | **mdc-slider:** skip resizing while the user is dragging ([#&#8203;25318](angular/components#25318)) |

#### Special Thanks

Amadou Sall, Kristiyan Kostadinov, Paul Gschwendtner and Serge

<!-- 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:eyJjcmVhdGVkSW5WZXIiOiIzMi4xNDEuMCIsInVwZGF0ZWRJblZlciI6IjMyLjE0MS4wIn0=-->

Co-authored-by: cabr2-bot <[email protected]>
Co-authored-by: Epsilon_02 <[email protected]>
Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1491
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 Aug 20, 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
3 participants