From 7852f31f7ea1819f9c7f2fe7ec5287663f75d88e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sun, 2 Jun 2019 19:28:24 +0200 Subject: [PATCH] clear token on pagination when events start overlapping --- src/matrix/room/timeline/persistence/GapWriter.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/timeline/persistence/GapWriter.js b/src/matrix/room/timeline/persistence/GapWriter.js index ba25f909..dfef468e 100644 --- a/src/matrix/room/timeline/persistence/GapWriter.js +++ b/src/matrix/room/timeline/persistence/GapWriter.js @@ -64,14 +64,20 @@ export default class GapWriter { if (neighbourFragmentEntry) { fragmentEntry.linkedFragmentId = neighbourFragmentEntry.fragmentId; neighbourFragmentEntry.linkedFragmentId = fragmentEntry.fragmentId; + // if neighbourFragmentEntry was found, it means the events were overlapping, + // so no pagination should happen anymore. + neighbourFragmentEntry.token = null; + fragmentEntry.token = null; + txn.timelineFragments.update(neighbourFragmentEntry.fragment); directionalAppend(entries, neighbourFragmentEntry, direction); // update fragmentIdComparer here after linking up fragments this._fragmentIdComparer.add(fragmentEntry.fragment); this._fragmentIdComparer.add(neighbourFragmentEntry.fragment); + } else { + fragmentEntry.token = end; } - fragmentEntry.token = end; txn.timelineFragments.update(fragmentEntry.fragment); }