@@ -179,9 +179,7 @@ export interface IRoomState {
179
179
// this is true if we are fully scrolled-down, and are looking at
180
180
// the end of the live timeline. It has the effect of hiding the
181
181
// '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 ;
185
183
showTopUnreadMessagesBar : boolean ;
186
184
statusBarVisible : boolean ;
187
185
// 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> {
257
255
isPeeking : false ,
258
256
showRightPanel : false ,
259
257
joining : false ,
260
- atEndOfLiveTimeline : true ,
261
- atEndOfLiveTimelineInit : false ,
262
258
showTopUnreadMessagesBar : false ,
263
259
statusBarVisible : false ,
264
260
canReact : false ,
@@ -692,9 +688,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
692
688
// in render() prevents the ref from being set on first mount, so we try and
693
689
// catch the messagePanel when it does mount. Because we only want the ref once,
694
690
// we use a boolean flag to avoid duplicate work.
695
- if ( this . messagePanel && ! this . state . atEndOfLiveTimelineInit ) {
691
+ if ( this . messagePanel && this . state . atEndOfLiveTimeline === undefined ) {
696
692
this . setState ( {
697
- atEndOfLiveTimelineInit : true ,
698
693
atEndOfLiveTimeline : this . messagePanel . isAtEndOfLiveTimeline ( ) ,
699
694
} ) ;
700
695
}
@@ -2102,7 +2097,7 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
2102
2097
}
2103
2098
let jumpToBottom ;
2104
2099
// 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 ) {
2106
2101
jumpToBottom = ( < JumpToBottomButton
2107
2102
highlight = { this . state . room . getUnreadNotificationCount ( NotificationCountType . Highlight ) > 0 }
2108
2103
numUnreadMessages = { this . state . numUnreadMessages }
0 commit comments