forked from mystiq/hydrogen-web
Move event to remoteEntries if needed
This commit is contained in:
parent
d924dbb723
commit
f5fadf700e
1 changed files with 12 additions and 0 deletions
|
@ -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 a new issue