File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
core/src/components/modal Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -404,6 +404,7 @@ export class Modal implements ComponentInterface, OverlayInterface {
404404 this . triggerController . removeClickListener ( ) ;
405405 this . cleanupViewTransitionListener ( ) ;
406406 this . cleanupParentRemovalObserver ( ) ;
407+ this . cachedOriginalParent = undefined ;
407408 }
408409
409410 componentWillLoad ( ) {
@@ -1200,6 +1201,9 @@ export class Modal implements ComponentInterface, OverlayInterface {
12001201
12011202 if ( cachedParentWasRemoved || cachedParentDisconnected ) {
12021203 this . dismiss ( undefined , 'parent-removed' ) ;
1204+ // Release the reference to the cached original parent
1205+ // so we don't have a memory leak
1206+ this . cachedOriginalParent = undefined ;
12031207 }
12041208 }
12051209 } ) ;
@@ -1213,10 +1217,8 @@ export class Modal implements ComponentInterface, OverlayInterface {
12131217 }
12141218
12151219 private cleanupParentRemovalObserver ( ) {
1216- if ( this . parentRemovalObserver ) {
1217- this . parentRemovalObserver . disconnect ( ) ;
1218- this . parentRemovalObserver = undefined ;
1219- }
1220+ this . parentRemovalObserver ?. disconnect ( ) ;
1221+ this . parentRemovalObserver = undefined ;
12201222 }
12211223
12221224 render ( ) {
You can’t perform that action at this time.
0 commit comments