diff --git a/src/matrix/room/timeline/Timeline.js b/src/matrix/room/timeline/Timeline.js index f58e7b83..1b980fee 100644 --- a/src/matrix/room/timeline/Timeline.js +++ b/src/matrix/room/timeline/Timeline.js @@ -251,6 +251,7 @@ export class Timeline { addEntries(newEntries) { this._addLocalRelationsToNewRemoteEntries(newEntries); this._updateFetchedEntries(newEntries); + this._moveFetchedEntryToRemoteEntries(newEntries); this._loadRelatedEvents(newEntries); this._remoteEntries.setManySorted(newEntries); } @@ -266,6 +267,17 @@ export class Timeline { } } + _moveFetchedEntryToRemoteEntries(entries) { + // if some entry in entries is also in fetchedEntries, we need to remove it from fetchedEntries + for (const entry of entries) { + const fetchedEntry = this._fetchedEventEntries.get(entry.id); + if (fetchedEntry) { + fetchedEntry.dependents.forEach(e => e.setContextEntry(entry)); + entry.updateFrom(fetchedEntry); + } + } + } + _updateEntry(entry) { const txnId = entry.isPending ? entry.id : null; const eventId = entry.isPending ? null : entry.id;