From 828c51467ffa6d3c9d713a326e3f46518403d1f1 Mon Sep 17 00:00:00 2001 From: Travis Ralston Date: Fri, 5 Apr 2019 11:36:01 -0600 Subject: [PATCH] Refuse to set forwards pagination token on live timeline Should fix the error seen in https://github.com/matrix-org/riot-web-rageshakes/issues/1389 (https://github.com/vector-im/riot-web/issues/8593) --- src/models/event-timeline-set.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/models/event-timeline-set.js b/src/models/event-timeline-set.js index 9675f7300ed..6025b7d774f 100644 --- a/src/models/event-timeline-set.js +++ b/src/models/event-timeline-set.js @@ -446,6 +446,14 @@ EventTimelineSet.prototype.addEventsToTimeline = function(events, toStartOfTimel // new information, we update the pagination token for whatever // timeline we ended up on. if (lastEventWasNew || !didUpdate) { + if (direction === EventTimeline.FORWARDS && timeline === this._liveTimeline) { + console.warn({lastEventWasNew, didUpdate}); // for debugging + console.warn( + `Refusing to set forwards pagination token of live timeline ` + + `${timeline} to ${paginationToken}`, + ); + return; + } timeline.setPaginationToken(paginationToken, direction); } };