Skip to content

MdDialog seems to leak the displayed components #2734

Closed
@mirceac72

Description

@mirceac72

Bug, feature request, or proposal:

Hi All,

I am using MdDialog to display some modal views defined by Angular 2 components. I observed that the instances of these components are still present in the browser snapshots after the dialog was closed. For example, I display a confirmation dialog for 10 times using a TwoOptions component. After that, the memory snapshot will contain 10 instances of the TwoOptions component.

What is the expected behavior?

No instance of the displayed components using MdDialog should remain.

What is the current behavior?

The instances of the displayed component are still present, being retained by MdDialogContainer.

What are the steps to reproduce?

Open and close a MdDialog view specifying a custom component.

The following plunker provided by
Making use of Dialogs in Material 2 (MdDialog)
can be used to ilustrate the issue
http://plnkr.co/edit/6Eta3GhQLUJTsYz22wsL?p=preview

Press Open Dialog for few times, collect a snapshot in Chrome and check for the ConfirmDialog instances.
image

What is the use-case or motivation for changing an existing behavior?

Which versions of Angular, Material, OS, browsers are affected?

Angular 2.4.3, @angular/material: 2.0.0-beta.1, Windows 7, Chrome, Firefox

Is there anything else we should know?

Metadata

Metadata

Assignees

Labels

P2The issue is important to a large percentage of users, with a workaround

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions