@@ -52,9 +52,8 @@ const GROUP_PHASES = [
5252*/
5353export default class RightPanelStore extends ReadyWatchingStore {
5454 private static internalInstance : RightPanelStore ;
55+ private readonly dispatcherRefRightPanelStore : string ;
5556 private viewedRoomId : string ;
56- private isViewingRoom ?: boolean ;
57- private dispatcherRefRightPanelStore : string ;
5857 private isReady = false ;
5958
6059 private global ?: IRightPanelForRoom = null ;
@@ -228,9 +227,8 @@ export default class RightPanelStore extends ReadyWatchingStore {
228227 }
229228 }
230229
231- // Private
232230 private loadCacheFromSettings ( ) {
233- const room = this . mxClient ?. getRoom ( this . viewedRoomId ) ;
231+ const room = this . viewedRoomId && this . mxClient ?. getRoom ( this . viewedRoomId ) ;
234232 if ( ! ! room ) {
235233 this . global = this . global ??
236234 convertToStatePanel ( SettingsStore . getValue ( "RightPanel.phasesGlobal" ) , room ) ;
@@ -362,10 +360,9 @@ export default class RightPanelStore extends ReadyWatchingStore {
362360 }
363361 } ;
364362
365- onRoomViewStoreUpdate = ( ) => {
363+ private onRoomViewStoreUpdate = ( ) => {
366364 // TODO: only use this function instead of the onDispatch (the whole onDispatch can get removed!) as soon groups are removed
367365 this . viewedRoomId = RoomViewStore . getRoomId ( ) ;
368- this . isViewingRoom = true ; // Is viewing room will of course be removed when removing groups
369366 // load values from byRoomCache with the viewedRoomId.
370367 this . loadCacheFromSettings ( ) ;
371368 // If the right panel stays open mode is used, and the panel was either
@@ -386,11 +383,13 @@ export default class RightPanelStore extends ReadyWatchingStore {
386383 this . emitAndUpdateSettings ( ) ;
387384 } ;
388385
389- onDispatch = ( payload : ActionPayload ) => {
386+ private get isViewingRoom ( ) : boolean {
387+ return ! ! this . viewedRoomId ;
388+ }
389+
390+ private onDispatch = ( payload : ActionPayload ) => {
390391 switch ( payload . action ) {
391392 case 'view_group' : {
392- if ( payload . room_id === this . viewedRoomId ) break ; // skip this transition, probably a permalink
393-
394393 // Put group in the same/similar view to what was open from the previously viewed room
395394 // Is contradictory to the new "per room" philosophy but it is the legacy behavior for groups.
396395
@@ -401,10 +400,8 @@ export default class RightPanelStore extends ReadyWatchingStore {
401400 this . setRightPanelCache ( { phase : RightPanelPhases . GroupMemberList , state : { } } ) ;
402401 }
403402
404- // Update the current room here, so that all the other functions dont need to be room dependant.
405403 // 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
408405 // load values from byRoomCache with the viewedRoomId.
409406 if ( this . isReady ) {
410407 // we need the client to be ready to get the events form the ids of the settings
0 commit comments