Prevent multiple concurrent vue app instances

This commit is contained in:
Tamius Han 2021-10-26 20:11:03 +02:00
parent e9b882376c
commit 6cb8cc174b

View File

@ -39,6 +39,10 @@ class UI {
} }
async initUi() { async initUi() {
if (this.app) {
this.app.unmount();
}
const random = Math.round(Math.random() * 69420); const random = Math.round(Math.random() * 69420);
const uwid = `uw-${this.interfaceId}-root-${random}` const uwid = `uw-${this.interfaceId}-root-${random}`
@ -71,6 +75,8 @@ class UI {
*/ */
replace(newUiConfig) { replace(newUiConfig) {
this.element?.remove(); this.element?.remove();
this.app.unmount();
this.app = undefined;
this.uiConfig = newUiConfig; this.uiConfig = newUiConfig;
this.initUi(); this.initUi();
} }
@ -78,6 +84,8 @@ class UI {
destroy() { destroy() {
// this.comms?.destroy(); // this.comms?.destroy();
this.element?.remove(); this.element?.remove();
this.app.unmount();
this.app = undefined;
} }
} }