From 7875d37c8ecbdbf375d8d06064396ee321d95c13 Mon Sep 17 00:00:00 2001 From: David Baker Date: Wed, 1 Aug 2018 15:01:11 +0100 Subject: [PATCH] Destroy non-persistent widgets when switching room --- src/components/views/elements/AppTile.js | 3 +++ src/stores/ActiveWidgetStore.js | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index bd88327b7f..d9593ff52a 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -161,6 +161,8 @@ export default class AppTile extends React.Component { // if it's not remaining on screen, get rid of the PersistedElement container if (!ActiveWidgetStore.getWidgetPersistence(this.props.id)) { ActiveWidgetStore.destroyPersistentWidget(); + const PersistedElement = sdk.getComponent("elements.PersistedElement"); + PersistedElement.destroyElement(this._persistKey); } } @@ -437,6 +439,7 @@ export default class AppTile extends React.Component { // Force the widget to be non-persistent ActiveWidgetStore.destroyPersistentWidget(); + PersistedElement.destroyElement(this._persistKey); } formatAppTileName() { diff --git a/src/stores/ActiveWidgetStore.js b/src/stores/ActiveWidgetStore.js index cc27febaf9..fe83260cde 100644 --- a/src/stores/ActiveWidgetStore.js +++ b/src/stores/ActiveWidgetStore.js @@ -75,8 +75,6 @@ class ActiveWidgetStore extends EventEmitter { destroyPersistentWidget() { const toDeleteId = this._persistentWidgetId; - const PersistedElement = sdk.getComponent("elements.PersistedElement"); - PersistedElement.destroyElement('widget_' + toDeleteId); this.setWidgetPersistence(toDeleteId, false); this.delWidgetMessaging(toDeleteId); this.delWidgetCapabilities(toDeleteId);