Use new preparing event for widget communications
Fixes https://github.com/vector-im/element-web/issues/15404 We need to make sure we don't accidentally call the widget before its ready, but we can happily show it once it is loaded/prepared.
This commit is contained in:
parent
bce0204eb6
commit
d38b544a42
2 changed files with 7 additions and 1 deletions
|
@ -50,6 +50,7 @@ export default class AppTile extends React.Component {
|
|||
// The key used for PersistedElement
|
||||
this._persistKey = 'widget_' + this.props.app.id;
|
||||
this._sgWidget = new StopGapWidget(this.props);
|
||||
this._sgWidget.on("preparing", this._onWidgetPrepared);
|
||||
this._sgWidget.on("ready", this._onWidgetReady);
|
||||
this.iframe = null; // ref to the iframe (callback style)
|
||||
|
||||
|
@ -142,6 +143,7 @@ export default class AppTile extends React.Component {
|
|||
this._sgWidget.stop();
|
||||
}
|
||||
this._sgWidget = new StopGapWidget(newProps);
|
||||
this._sgWidget.on("preparing", this._onWidgetPrepared);
|
||||
this._sgWidget.on("ready", this._onWidgetReady);
|
||||
this._startWidget();
|
||||
}
|
||||
|
@ -295,8 +297,11 @@ export default class AppTile extends React.Component {
|
|||
this._revokeWidgetPermission();
|
||||
}
|
||||
|
||||
_onWidgetReady = () => {
|
||||
_onWidgetPrepared = () => {
|
||||
this.setState({loading: false});
|
||||
};
|
||||
|
||||
_onWidgetReady = () => {
|
||||
if (WidgetType.JITSI.matches(this.props.app.type)) {
|
||||
this._sgWidget.widgetApi.transport.send(ElementWidgetActions.ClientReady, {});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue