Skip to content

MdDialog seems to leak the displayed components #2734

Closed

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?

Activity

  1. added
    P2
    on Jan 25, 2017
  2. crisbeto commented on Jan 30, 2017

    @crisbeto
    Member

    Managed to track this one down, but am still looking for a proper fix. As an aside, we seem to be leaking some more objects as well: the MdDialogContainer and MdDialogRef instances. I'll try to address the other leaks separately.

  3. added a commit that references this issue on Jan 31, 2017
    dc04438
  4. added a commit that references this issue on Mar 16, 2017
    afc8d8b
  5. added a commit that references this issue on Mar 17, 2017
    e120e8d
  6. added a commit that references this issue on Apr 16, 2017
    ac476e4
  7. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    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.

  8. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions