This repository was archived by the owner on Sep 11, 2024. It is now read-only.
File tree 1 file changed +10
-2
lines changed
src/components/views/elements
1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -243,7 +243,11 @@ export default class AppTile extends React.Component<IProps, IState> {
243
243
}
244
244
this . watchUserReady ( ) ;
245
245
246
- WidgetLayoutStore . instance . on ( WidgetLayoutStore . emissionForRoom ( this . props . room ) , this . onWidgetLayoutChange ) ;
246
+ if ( this . props . room ) {
247
+ const emitEvent = WidgetLayoutStore . emissionForRoom ( this . props . room ) ;
248
+ WidgetLayoutStore . instance . on ( emitEvent , this . onWidgetLayoutChange ) ;
249
+ }
250
+
247
251
this . roomStoreToken = RoomViewStore . addListener ( this . onRoomViewStoreUpdate ) ;
248
252
this . allowedWidgetsWatchRef = SettingsStore . watchSetting ( "allowedWidgets" , null , this . onAllowedWidgetsChange ) ;
249
253
// Widget action listeners
@@ -254,7 +258,11 @@ export default class AppTile extends React.Component<IProps, IState> {
254
258
// Widget action listeners
255
259
if ( this . dispatcherRef ) dis . unregister ( this . dispatcherRef ) ;
256
260
257
- WidgetLayoutStore . instance . off ( WidgetLayoutStore . emissionForRoom ( this . props . room ) , this . onWidgetLayoutChange ) ;
261
+ if ( this . props . room ) {
262
+ const emitEvent = WidgetLayoutStore . emissionForRoom ( this . props . room ) ;
263
+ WidgetLayoutStore . instance . off ( emitEvent , this . onWidgetLayoutChange ) ;
264
+ }
265
+
258
266
this . roomStoreToken ?. remove ( ) ;
259
267
SettingsStore . unwatchSetting ( this . allowedWidgetsWatchRef ) ;
260
268
OwnProfileStore . instance . removeListener ( UPDATE_EVENT , this . onUserReady ) ;
You can’t perform that action at this time.
0 commit comments