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 {
404
404
this . triggerController . removeClickListener ( ) ;
405
405
this . cleanupViewTransitionListener ( ) ;
406
406
this . cleanupParentRemovalObserver ( ) ;
407
+ this . cachedOriginalParent = undefined ;
407
408
}
408
409
409
410
componentWillLoad ( ) {
@@ -1200,6 +1201,9 @@ export class Modal implements ComponentInterface, OverlayInterface {
1200
1201
1201
1202
if ( cachedParentWasRemoved || cachedParentDisconnected ) {
1202
1203
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 ;
1203
1207
}
1204
1208
}
1205
1209
} ) ;
@@ -1213,10 +1217,8 @@ export class Modal implements ComponentInterface, OverlayInterface {
1213
1217
}
1214
1218
1215
1219
private cleanupParentRemovalObserver ( ) {
1216
- if ( this . parentRemovalObserver ) {
1217
- this . parentRemovalObserver . disconnect ( ) ;
1218
- this . parentRemovalObserver = undefined ;
1219
- }
1220
+ this . parentRemovalObserver ?. disconnect ( ) ;
1221
+ this . parentRemovalObserver = undefined ;
1220
1222
}
1221
1223
1222
1224
render ( ) {
You can’t perform that action at this time.
0 commit comments