Clarify and simplfiy unpagination logic

This commit is contained in:
Luke Barnard 2017-04-04 13:28:26 +01:00
parent 94fe9999db
commit 5737994957
2 changed files with 20 additions and 24 deletions

View file

@ -251,10 +251,12 @@ var TimelinePanel = React.createClass({
},
onMessageListUnfillRequest: function(backwards, scrollToken) {
// If backwards, unpaginate from the back
let dir = backwards ? EventTimeline.BACKWARDS : EventTimeline.FORWARDS;
debuglog("TimelinePanel: unpaginating events in direction", dir);
// All tiles are inserted by MessagePanel to have a scrollToken === eventId
// All tiles are inserted by MessagePanel to have a scrollToken === eventId, and
// this particular event should be the first or last to be unpaginated.
let eventId = scrollToken;
let marker = this.state.events.findIndex(