From 3bd33d09850607dfebbc83f624501c8eea4252ff Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Thu, 10 Mar 2016 13:39:19 +0000 Subject: [PATCH] Fix the missing date separator at the start of rooms When we first hit the start of the room, we still have a pagination token, so we hide the date separator. When we try to backpaginate again, we get an empty result, and the pagination token is cleared. Make sure that we update state. canBackPaginate even when there are no new results, to handle this case. Fixes https://github.com/vector-im/vector-web/issues/1014 --- src/components/structures/TimelinePanel.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/components/structures/TimelinePanel.js b/src/components/structures/TimelinePanel.js index a87cd2b345..46be84e3dd 100644 --- a/src/components/structures/TimelinePanel.js +++ b/src/components/structures/TimelinePanel.js @@ -188,7 +188,7 @@ var TimelinePanel = React.createClass({ debuglog("TimelinePanel: paginate complete backwards:"+backwards+"; success:"+r); this.setState({[statekey]: false}); - this._onTimelineUpdated(r); + this._onTimelineUpdated(); return r; }); }, @@ -555,7 +555,7 @@ var TimelinePanel = React.createClass({ // calling _onTimelineUpdated and updating the state. var onLoaded = () => { - this._onTimelineUpdated(true); + this._onTimelineUpdated(); this.setState({timelineLoading: false}, () => { // initialise the scroll state of the message panel @@ -586,17 +586,15 @@ var TimelinePanel = React.createClass({ prom.done(); }, - _onTimelineUpdated: function(gotResults) { + _onTimelineUpdated: function() { // we might have switched rooms since the load started - just bin // the results if so. if (this.unmounted) return; - if (gotResults) { - this.setState({ - events: this._timelineWindow.getEvents(), - canBackPaginate: this._timelineWindow.canPaginate(EventTimeline.BACKWARDS), - }); - } + this.setState({ + events: this._timelineWindow.getEvents(), + canBackPaginate: this._timelineWindow.canPaginate(EventTimeline.BACKWARDS), + }); }, _indexForEventId: function(evId) {