Guard entry from storage being processed by method

This commit is contained in:
RMidhunSuresh 2022-01-11 14:49:59 +05:30
parent bf6dfcfcad
commit 73733ce145
2 changed files with 5 additions and 1 deletions

View file

@ -274,7 +274,7 @@ export class Timeline {
*/
for (const entry of entries) {
const relatedEntry = this._contextEntriesNotInTimeline.get(entry.relatedEventId);
if (relatedEntry?.addRelation(entry)) {
if (relatedEntry?.isNonPersisted && relatedEntry?.addRelation(entry)) {
// update other entries for which this entry is a context entry
relatedEntry.contextForEntries?.forEach(e => {
this._remoteEntries.findAndUpdate(te => te.id === e.id, () => "contextEntry");

View file

@ -27,4 +27,8 @@ export class NonPersistedEventEntry extends EventEntry {
get entryIndex() {
throw new Error("Cannot access entryIndex for non-persisted EventEntry");
}
get isNonPersisted() {
return true;
}
}