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

bug: Detached nodes after dismissing modal #28898

Closed
3 tasks done
aeharding opened this issue Jan 28, 2024 · 2 comments
Closed
3 tasks done

bug: Detached nodes after dismissing modal #28898

aeharding opened this issue Jan 28, 2024 · 2 comments
Labels

Comments

@aeharding
Copy link
Contributor

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
@liamdebeasi
Copy link
Contributor

Thanks for the report. There are two problems here:

  1. We are not properly cleaning up the dismiss animation for overlays. This prevents the element from being garbage collected when using an inline overlay. This is being tracked in bug: IonModal with presentingElement doesn't render on iOS #28352, and we have in-progress work to resolve this: fix(overlays): tear down animations after dismiss #28907
  2. There is a problem when using light DOM components in Stencil. This is being tracked in bug: light dom custom element with comment node causes retainer #28189. The Stencil team has a fix in place, and we are currently testing inside of Ionic.

I am going to close this issue in favor of the two linked ones. Let me know if you have questions.

@liamdebeasi liamdebeasi closed this as not planned Won't fix, can't repro, duplicate, stale Jan 29, 2024
@liamdebeasi liamdebeasi removed their assignment Jan 29, 2024
Copy link

ionitron-bot bot commented Feb 29, 2024

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants