From b68960ad261b299d5cf1b991b196922a81919da9 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 15 Mar 2019 22:24:27 -0600 Subject: [PATCH] Reload widget messaging when widgets reload Fixes a bug for some widgets where they cannot do their startup routine (capabilities negotiation, etc) when someone maximizes the widget. By reloading the widget messaging, we ensure the widget is kept in the loop. --- src/components/views/elements/AppTile.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index fe0141dde0..8ed408ffbe 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -336,9 +336,14 @@ export default class AppTile extends React.Component { * Called when widget iframe has finished loading */ _onLoaded() { - if (!ActiveWidgetStore.getWidgetMessaging(this.props.id)) { - this._setupWidgetMessaging(); + // Destroy the old widget messaging before starting it back up again. Some widgets + // have startup routines that run when they are loaded, so we just need to reinitialize + // the messaging for them. + if (ActiveWidgetStore.getWidgetMessaging(this.props.id)) { + ActiveWidgetStore.delWidgetMessaging(this.props.id); } + this._setupWidgetMessaging(); + ActiveWidgetStore.setRoomId(this.props.id, this.props.room.roomId); this.setState({loading: false}); }