mirror of https://github.com/vector-im/riot-web
Fix left panel widgets causing app-wide crash (#7660)
parent
7567aebe47
commit
cb2c835c09
|
@ -243,7 +243,11 @@ export default class AppTile extends React.Component<IProps, IState> {
|
||||||
}
|
}
|
||||||
this.watchUserReady();
|
this.watchUserReady();
|
||||||
|
|
||||||
WidgetLayoutStore.instance.on(WidgetLayoutStore.emissionForRoom(this.props.room), this.onWidgetLayoutChange);
|
if (this.props.room) {
|
||||||
|
const emitEvent = WidgetLayoutStore.emissionForRoom(this.props.room);
|
||||||
|
WidgetLayoutStore.instance.on(emitEvent, this.onWidgetLayoutChange);
|
||||||
|
}
|
||||||
|
|
||||||
this.roomStoreToken = RoomViewStore.addListener(this.onRoomViewStoreUpdate);
|
this.roomStoreToken = RoomViewStore.addListener(this.onRoomViewStoreUpdate);
|
||||||
this.allowedWidgetsWatchRef = SettingsStore.watchSetting("allowedWidgets", null, this.onAllowedWidgetsChange);
|
this.allowedWidgetsWatchRef = SettingsStore.watchSetting("allowedWidgets", null, this.onAllowedWidgetsChange);
|
||||||
// Widget action listeners
|
// Widget action listeners
|
||||||
|
@ -254,7 +258,11 @@ export default class AppTile extends React.Component<IProps, IState> {
|
||||||
// Widget action listeners
|
// Widget action listeners
|
||||||
if (this.dispatcherRef) dis.unregister(this.dispatcherRef);
|
if (this.dispatcherRef) dis.unregister(this.dispatcherRef);
|
||||||
|
|
||||||
WidgetLayoutStore.instance.off(WidgetLayoutStore.emissionForRoom(this.props.room), this.onWidgetLayoutChange);
|
if (this.props.room) {
|
||||||
|
const emitEvent = WidgetLayoutStore.emissionForRoom(this.props.room);
|
||||||
|
WidgetLayoutStore.instance.off(emitEvent, this.onWidgetLayoutChange);
|
||||||
|
}
|
||||||
|
|
||||||
this.roomStoreToken?.remove();
|
this.roomStoreToken?.remove();
|
||||||
SettingsStore.unwatchSetting(this.allowedWidgetsWatchRef);
|
SettingsStore.unwatchSetting(this.allowedWidgetsWatchRef);
|
||||||
OwnProfileStore.instance.removeListener(UPDATE_EVENT, this.onUserReady);
|
OwnProfileStore.instance.removeListener(UPDATE_EVENT, this.onUserReady);
|
||||||
|
|
Loading…
Reference in New Issue