From 4f22c23589d21603f0cb880b3d82ab71ddc75c4f Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Thu, 9 Sep 2021 16:09:54 -0700 Subject: [PATCH] Add new fragment to ID comparer --- src/matrix/room/timeline/persistence/GapWriter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/matrix/room/timeline/persistence/GapWriter.js b/src/matrix/room/timeline/persistence/GapWriter.js index 1b2a119d..164c231d 100644 --- a/src/matrix/room/timeline/persistence/GapWriter.js +++ b/src/matrix/room/timeline/persistence/GapWriter.js @@ -287,10 +287,13 @@ export class GapWriter { const newFragment = await this._createNewFragment(txn); newFragment.nextToken = end; newFragment.previousToken = start; + // Pretend that we did find an overlapping entry above, and that this entry is for the new fragment. const newEntry = FragmentBoundaryEntry.end(newFragment, this._fragmentIdComparer); overlapUp.neighbourFragmentEntry = newEntry; - return this._linkOverlapping(overlapUp, overlapDown, event, end, state, txn, log); + const linkResult = await this._linkOverlapping(overlapUp, overlapDown, event, end, state, txn, log); + linkResult.fragments.push(newFragment); + return linkResult; } async writeFragmentFill(fragmentEntry, response, txn, log) {