diff --git a/src/matrix/room/timeline/FragmentIdComparer.js b/src/matrix/room/timeline/FragmentIdComparer.js index c26aa043..d88b257b 100644 --- a/src/matrix/room/timeline/FragmentIdComparer.js +++ b/src/matrix/room/timeline/FragmentIdComparer.js @@ -134,6 +134,13 @@ export default class FragmentIdComparer { rebuild(fragments) { const islands = createIslands(fragments); + const fragmentJson = JSON.stringify(islands.map(i => { + return Array.from(i._idToSortIndex.entries()) + .map(([id, idx]) => {return {id, idx};}) + .sort((a, b) => a.idx - b.idx); + })); + const firstFragment = this._fragmentsById.values().next().value; + console.log("rebuilt fragment index", firstFragment && firstFragment.roomId, fragmentJson); this._idToIsland = new Map(); for(let island of islands) { for(let id of island.fragmentIds) { diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index 99828479..353b8634 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -33,7 +33,13 @@ export default class Timeline { /** @package */ appendLiveEntries(newEntries) { - this._remoteEntries.setManySorted(newEntries); + try { + this._remoteEntries.setManySorted(newEntries); + } catch (err) { + console.error("error while appending live entries in roomId", this._roomId); + console.error(err.stack); + throw err; + } } /** @public */