From 309e5401eb3f40f10e345e89e482b533d8759637 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 Nov 2016 10:18:24 +0000 Subject: [PATCH 1/2] Fix pagination issue where recent events are lost Scrolling up a few pages followed by scrolling down to the most recent events previously caused some events to go missing. A test has been modified in conjunction with this fix to make sure that this failure mode is tested for in future. This commit should fix the issue, and the most recent events should be paginated back in. --- src/components/structures/TimelinePanel.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 3d204be5103..84beb1253b3 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -265,7 +265,11 @@ var TimelinePanel = React.createClass({ if (count > 0) { debuglog("TimelinePanel: Unpaginating", count, "in direction", dir); this._timelineWindow.unpaginate(count, backwards); + + // We can now paginate in the unpaginated direction + let canPaginateKey = (backwards) ? 'canBackPaginate' : 'canForwardPaginate'; this.setState({ + [canPaginateKey]: true, events: this._getEvents(), }); } From 9c4481494cfa2b6f0a099cd61d5c7d4ec549045b Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Fri, 18 Nov 2016 11:07:31 +0000 Subject: [PATCH 2/2] let -> const --- src/components/structures/TimelinePanel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index 84beb1253b3..4311f683df4 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -267,7 +267,7 @@ var TimelinePanel = React.createClass({ this._timelineWindow.unpaginate(count, backwards); // We can now paginate in the unpaginated direction - let canPaginateKey = (backwards) ? 'canBackPaginate' : 'canForwardPaginate'; + const canPaginateKey = (backwards) ? 'canBackPaginate' : 'canForwardPaginate'; this.setState({ [canPaginateKey]: true, events: this._getEvents(),