@@ -179,9 +179,7 @@ export interface IRoomState {
179179 // this is true if we are fully scrolled-down, and are looking at
180180 // the end of the live timeline. It has the effect of hiding the
181181 // 'scroll to bottom' knob, among a couple of other things.
182- atEndOfLiveTimeline : boolean ;
183- // used by componentDidUpdate to avoid unnecessary checks
184- atEndOfLiveTimelineInit : boolean ;
182+ atEndOfLiveTimeline ?: boolean ;
185183 showTopUnreadMessagesBar : boolean ;
186184 statusBarVisible : boolean ;
187185 // We load this later by asking the js-sdk to suggest a version for us.
@@ -257,8 +255,6 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
257255 isPeeking : false ,
258256 showRightPanel : false ,
259257 joining : false ,
260- atEndOfLiveTimeline : true ,
261- atEndOfLiveTimelineInit : false ,
262258 showTopUnreadMessagesBar : false ,
263259 statusBarVisible : false ,
264260 canReact : false ,
@@ -692,9 +688,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
692688 // in render() prevents the ref from being set on first mount, so we try and
693689 // catch the messagePanel when it does mount. Because we only want the ref once,
694690 // we use a boolean flag to avoid duplicate work.
695- if ( this . messagePanel && ! this . state . atEndOfLiveTimelineInit ) {
691+ if ( this . messagePanel && this . state . atEndOfLiveTimeline === undefined ) {
696692 this . setState ( {
697- atEndOfLiveTimelineInit : true ,
698693 atEndOfLiveTimeline : this . messagePanel . isAtEndOfLiveTimeline ( ) ,
699694 } ) ;
700695 }
@@ -2102,7 +2097,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
21022097 }
21032098 let jumpToBottom ;
21042099 // Do not show JumpToBottomButton if we have search results showing, it makes no sense
2105- if ( ! this . state . atEndOfLiveTimeline && ! this . state . searchResults ) {
2100+ if ( this . state . atEndOfLiveTimeline === false && ! this . state . searchResults ) {
21062101 jumpToBottom = ( < JumpToBottomButton
21072102 highlight = { this . state . room . getUnreadNotificationCount ( NotificationCountType . Highlight ) > 0 }
21082103 numUnreadMessages = { this . state . numUnreadMessages }
0 commit comments