Destroy non-persistent widgets when switching room

pull/21833/head
David Baker 2018-08-01 15:01:11 +01:00
parent 2f13615dd1
commit 7875d37c8e
2 changed files with 3 additions and 2 deletions

View File

@ -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() {

View File

@ -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);