@@ -52,9 +52,8 @@ const GROUP_PHASES = [
52
52
*/
53
53
export default class RightPanelStore extends ReadyWatchingStore {
54
54
private static internalInstance : RightPanelStore ;
55
+ private readonly dispatcherRefRightPanelStore : string ;
55
56
private viewedRoomId : string ;
56
- private isViewingRoom ?: boolean ;
57
- private dispatcherRefRightPanelStore : string ;
58
57
private isReady = false ;
59
58
60
59
private global ?: IRightPanelForRoom = null ;
@@ -228,9 +227,8 @@ export default class RightPanelStore extends ReadyWatchingStore {
228
227
}
229
228
}
230
229
231
- // Private
232
230
private loadCacheFromSettings ( ) {
233
- const room = this . mxClient ?. getRoom ( this . viewedRoomId ) ;
231
+ const room = this . viewedRoomId && this . mxClient ?. getRoom ( this . viewedRoomId ) ;
234
232
if ( ! ! room ) {
235
233
this . global = this . global ??
236
234
convertToStatePanel ( SettingsStore . getValue ( "RightPanel.phasesGlobal" ) , room ) ;
@@ -362,10 +360,9 @@ export default class RightPanelStore extends ReadyWatchingStore {
362
360
}
363
361
} ;
364
362
365
- onRoomViewStoreUpdate = ( ) => {
363
+ private onRoomViewStoreUpdate = ( ) => {
366
364
// TODO: only use this function instead of the onDispatch (the whole onDispatch can get removed!) as soon groups are removed
367
365
this . viewedRoomId = RoomViewStore . getRoomId ( ) ;
368
- this . isViewingRoom = true ; // Is viewing room will of course be removed when removing groups
369
366
// load values from byRoomCache with the viewedRoomId.
370
367
this . loadCacheFromSettings ( ) ;
371
368
// If the right panel stays open mode is used, and the panel was either
@@ -386,11 +383,13 @@ export default class RightPanelStore extends ReadyWatchingStore {
386
383
this . emitAndUpdateSettings ( ) ;
387
384
} ;
388
385
389
- onDispatch = ( payload : ActionPayload ) => {
386
+ private get isViewingRoom ( ) : boolean {
387
+ return ! ! this . viewedRoomId ;
388
+ }
389
+
390
+ private onDispatch = ( payload : ActionPayload ) => {
390
391
switch ( payload . action ) {
391
392
case 'view_group' : {
392
- if ( payload . room_id === this . viewedRoomId ) break ; // skip this transition, probably a permalink
393
-
394
393
// Put group in the same/similar view to what was open from the previously viewed room
395
394
// Is contradictory to the new "per room" philosophy but it is the legacy behavior for groups.
396
395
@@ -401,10 +400,8 @@ export default class RightPanelStore extends ReadyWatchingStore {
401
400
this . setRightPanelCache ( { phase : RightPanelPhases . GroupMemberList , state : { } } ) ;
402
401
}
403
402
404
- // Update the current room here, so that all the other functions dont need to be room dependant.
405
403
// The right panel store always will return the state for the current room.
406
- this . viewedRoomId = payload . room_id ;
407
- this . isViewingRoom = false ;
404
+ this . viewedRoomId = null ; // a group is not a room
408
405
// load values from byRoomCache with the viewedRoomId.
409
406
if ( this . isReady ) {
410
407
// we need the client to be ready to get the events form the ids of the settings
0 commit comments