mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
fix(menu): refs are not destroyed on unmount (#27158)
This commit is contained in:
@ -234,7 +234,16 @@ export class Menu implements ComponentInterface, MenuI {
|
|||||||
this.updateState();
|
this.updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
disconnectedCallback() {
|
async disconnectedCallback() {
|
||||||
|
/**
|
||||||
|
* The menu should be closed when it is
|
||||||
|
* unmounted from the DOM.
|
||||||
|
* This is an async call, so we need to wait for
|
||||||
|
* this to finish otherwise contentEl
|
||||||
|
* will not have MENU_CONTENT_OPEN removed.
|
||||||
|
*/
|
||||||
|
await this.close(false);
|
||||||
|
|
||||||
this.blocker.destroy();
|
this.blocker.destroy();
|
||||||
menuController._unregister(this);
|
menuController._unregister(this);
|
||||||
if (this.animation) {
|
if (this.animation) {
|
||||||
@ -246,7 +255,7 @@ export class Menu implements ComponentInterface, MenuI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.animation = undefined;
|
this.animation = undefined;
|
||||||
this.contentEl = this.backdropEl = this.menuInnerEl = undefined;
|
this.contentEl = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Listen('ionSplitPaneVisible', { target: 'body' })
|
@Listen('ionSplitPaneVisible', { target: 'body' })
|
||||||
|
Reference in New Issue
Block a user