mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Move event to remoteEntries if needed
This commit is contained in:
parent
d924dbb723
commit
f5fadf700e
@ -251,6 +251,7 @@ export class Timeline {
|
|||||||
addEntries(newEntries) {
|
addEntries(newEntries) {
|
||||||
this._addLocalRelationsToNewRemoteEntries(newEntries);
|
this._addLocalRelationsToNewRemoteEntries(newEntries);
|
||||||
this._updateFetchedEntries(newEntries);
|
this._updateFetchedEntries(newEntries);
|
||||||
|
this._moveFetchedEntryToRemoteEntries(newEntries);
|
||||||
this._loadRelatedEvents(newEntries);
|
this._loadRelatedEvents(newEntries);
|
||||||
this._remoteEntries.setManySorted(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) {
|
_updateEntry(entry) {
|
||||||
const txnId = entry.isPending ? entry.id : null;
|
const txnId = entry.isPending ? entry.id : null;
|
||||||
const eventId = entry.isPending ? null : entry.id;
|
const eventId = entry.isPending ? null : entry.id;
|
||||||
|
Loading…
Reference in New Issue
Block a user