Move event to remoteEntries if needed

This commit is contained in:
RMidhunSuresh 2021-12-13 12:45:17 +05:30
parent d924dbb723
commit f5fadf700e

View File

@ -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;