Check if the message panel is at the end of the timeline on init
Fixes https://github.com/vector-im/riot-web/issues/8503 componentDidUpdate is called a lot, and we don't really want to keep checking the messagePanel, so this introduces a new flag to check if the init is even needed.pull/21833/head
parent
db834b315a
commit
4eb9fa6922
|
@ -144,6 +144,7 @@ module.exports = React.createClass({
|
|||
// the end of the live timeline. It has the effect of hiding the
|
||||
// 'scroll to bottom' knob, among a couple of other things.
|
||||
atEndOfLiveTimeline: true,
|
||||
atEndOfLiveTimelineInit: false, // used by componentDidUpdate to avoid unnecessary checks
|
||||
|
||||
showTopUnreadMessagesBar: false,
|
||||
|
||||
|
@ -428,6 +429,12 @@ module.exports = React.createClass({
|
|||
roomView.addEventListener('dragend', this.onDragLeaveOrEnd);
|
||||
}
|
||||
}
|
||||
if (this.refs.messagePanel && !this.state.atEndOfLiveTimelineInit) {
|
||||
this.setState({
|
||||
atEndOfLiveTimelineInit: true,
|
||||
atEndOfLiveTimeline: this.refs.messagePanel.isAtEndOfLiveTimeline(),
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
componentWillUnmount: function() {
|
||||
|
|
Loading…
Reference in New Issue