File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
core/src/components/modal Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -1183,6 +1183,20 @@ export class Modal implements ComponentInterface, OverlayInterface {
11831183 return ;
11841184 }
11851185
1186+ /**
1187+ * Don't observe for controller-based modals or when the parent is the
1188+ * app root (document.body or ion-app). These parents won't be removed,
1189+ * and observing document.body with subtree: true causes performance
1190+ * issues with frameworks like Angular during change detection.
1191+ */
1192+ if (
1193+ this . hasController ||
1194+ this . cachedOriginalParent === document . body ||
1195+ this . cachedOriginalParent . tagName === 'ION-APP'
1196+ ) {
1197+ return ;
1198+ }
1199+
11861200 this . parentRemovalObserver = new MutationObserver ( ( mutations ) => {
11871201 mutations . forEach ( ( mutation ) => {
11881202 if ( mutation . type === 'childList' && mutation . removedNodes . length > 0 ) {
You can’t perform that action at this time.
0 commit comments