@@ -146,6 +146,7 @@ class LoggedInView extends React.Component<IProps, IState> {
146146 protected readonly _resizeContainer : React . RefObject < ResizeHandle > ;
147147 protected readonly _sessionStore : sessionStore ;
148148 protected readonly _sessionStoreToken : { remove : ( ) => void } ;
149+ protected readonly _compactLayoutWatcherRef : string ;
149150 protected resizer : Resizer ;
150151
151152 constructor ( props , context ) {
@@ -177,6 +178,10 @@ class LoggedInView extends React.Component<IProps, IState> {
177178 this . _matrixClient . on ( "sync" , this . onSync ) ;
178179 this . _matrixClient . on ( "RoomState.events" , this . onRoomStateEvents ) ;
179180
181+ this . _compactLayoutWatcherRef = SettingsStore . watchSetting (
182+ "useCompactLayout" , null , this . onCompactLayoutChanged ,
183+ ) ;
184+
180185 fixupColorFonts ( ) ;
181186
182187 this . _roomView = React . createRef ( ) ;
@@ -194,6 +199,7 @@ class LoggedInView extends React.Component<IProps, IState> {
194199 this . _matrixClient . removeListener ( "accountData" , this . onAccountData ) ;
195200 this . _matrixClient . removeListener ( "sync" , this . onSync ) ;
196201 this . _matrixClient . removeListener ( "RoomState.events" , this . onRoomStateEvents ) ;
202+ SettingsStore . unwatchSetting ( this . _compactLayoutWatcherRef ) ;
197203 if ( this . _sessionStoreToken ) {
198204 this . _sessionStoreToken . remove ( ) ;
199205 }
@@ -263,16 +269,17 @@ class LoggedInView extends React.Component<IProps, IState> {
263269 }
264270
265271 onAccountData = ( event ) => {
266- if ( event . getType ( ) === "im.vector.web.settings" ) {
267- this . setState ( {
268- useCompactLayout : event . getContent ( ) . useCompactLayout ,
269- } ) ;
270- }
271272 if ( event . getType ( ) === "m.ignored_user_list" ) {
272273 dis . dispatch ( { action : "ignore_state_changed" } ) ;
273274 }
274275 } ;
275276
277+ onCompactLayoutChanged = ( setting , roomId , level , valueAtLevel , newValue ) => {
278+ this . setState ( {
279+ useCompactLayout : valueAtLevel ,
280+ } ) ;
281+ } ;
282+
276283 onSync = ( syncState , oldSyncState , data ) => {
277284 const oldErrCode = (
278285 this . state . syncErrorData &&
0 commit comments