You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: [React] IonModal is not removed from DOM when parent component unmounts #26185
I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
v4.x
v5.x
v6.x
Nightly
Current Behavior
When a component rendering an IonModal is unmounted by React, the ion modal DOM node is not removed.
Expected Behavior
Expected similar/same behavior as Ionic v5, where when a React component unmounts, the corresponding components being rendered by that component are also cleaned up. Even if there is no animation, I believe the DOM should be cleaned up
Steps to Reproduce
Have a component (Call it MyComponent) that renders an IonModal
Conditionally mount that component somewhere.
Toggle the modal to present by changing isOpen to true.
Now, without toggling the modal's isOpen prop, simply toggle the mounting condition so React unmounts MyComponent.
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.
Activity
sean-perkins commentedon Oct 27, 2022
@puopg thanks for reporting this issue!
I believe this may overlap with #25775, but we can track independently in the mean time.
Now that #25590 has been resolved, I can port over the exploration fix for dismissing any presented overlay when it's react component is unmounted.
puopg commentedon Oct 27, 2022
Ah I see, for some reason I thought #25775 was resolved with your fix and just not marked! Thanks for looking into this!
sean-perkins commentedon Nov 8, 2022
Hello @puopg can you test with this dev-build and let me know if you run into any issues?
I've additionally forked your reproduction here: https://codesandbox.io/s/ionic-6-3-3-modal-unmount-bug-forked-dflgj8
BenHen75 commentedon Nov 9, 2022
I had the same issue, your fix work perfectly @sean-perkins thx!!
puopg commentedon Nov 16, 2022
Hey, sorry i haven't been around to get to this. Ill check this out when I can and update!
puopg commentedon Nov 18, 2022
@sean-perkins Hey so far I think things looking good! Thanks!
filip-dot-cube commentedon Dec 12, 2022
Confirming, the issues seems to be fixed in
filip-dot-cube commentedon Dec 13, 2022
Actually it only works correctly with the
The 6.4 doesn't show the warning, but the modal stays open.
puopg commentedon Dec 14, 2022
@filip-dot-cube The PR is still open, so its not available on an official release to my understanding yet.
#26245
fix(react): inline overlays dismiss when parent component unmounts (#…
sean-perkins commentedon Mar 3, 2023
The PR to resolve this issue has been merged 🎉 and will be available in the next patch release of Ionic v6.6.1.
We appreciate the community's patience with this issue!
ionitron-bot commentedon Apr 2, 2023
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.