Skip to content

bug: Detached nodes after dismissing modal #28898

Description

@aeharding

Prerequisites

Ionic Framework Version

v7.x

Current Behavior

When using an Ionic Dialog, I see that HTML elements are retained after dismissal

Expected Behavior

No detached elements

Steps to Reproduce

  1. npm build example app
  2. Serve production build artifact (I use http-server dist)
  3. Open Chrome devtools, garbage collect, take a heap snapshot
  4. Open and dismiss dialog a few times
  5. Garbage collect and take another heap snapshot
  6. Compare snapshots
  7. Observe there are many detached HTML elements, with pair in WeakMap retainers

Code Reproduction URL

https://github.com/aeharding/ionic-modal-leak

Ionic Info

Ionic:

   Ionic CLI       : 7.1.1 (/Users/aeharding/.nvm/versions/node/v20.8.1/lib/node_modules/@ionic/cli)
   Ionic Framework : @ionic/react 7.6.6

Capacitor:

   Capacitor CLI      : 5.6.0
   @capacitor/android : not installed
   @capacitor/core    : 5.6.0
   @capacitor/ios     : not installed

Utility:

   cordova-res : not installed globally
   native-run  : not installed globally

System:

   NodeJS : v20.8.1 (/Users/aeharding/.nvm/versions/node/v20.8.1/bin/node)
   npm    : 10.1.0
   OS     : macOS Unknown

Additional Information

Screenshot 2024-01-28 at 12 09 28 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions