mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
fix problems with updating note in note cache when entities are coming out of order (e.g. sync)
This commit is contained in:
@@ -6,6 +6,33 @@ class Note {
|
||||
constructor(noteCache, row) {
|
||||
/** @param {NoteCache} */
|
||||
this.noteCache = noteCache;
|
||||
|
||||
this.update(row);
|
||||
|
||||
/** @param {Branch[]} */
|
||||
this.parentBranches = [];
|
||||
/** @param {Note[]} */
|
||||
this.parents = [];
|
||||
/** @param {Note[]} */
|
||||
this.children = [];
|
||||
/** @param {Attribute[]} */
|
||||
this.ownedAttributes = [];
|
||||
|
||||
/** @param {Attribute[]|null} */
|
||||
this.attributeCache = null;
|
||||
/** @param {Attribute[]|null} */
|
||||
this.inheritableAttributeCache = null;
|
||||
|
||||
/** @param {Attribute[]} */
|
||||
this.targetRelations = [];
|
||||
|
||||
this.noteCache.notes[this.noteId] = this;
|
||||
|
||||
/** @param {Note[]|null} */
|
||||
this.ancestorCache = null;
|
||||
}
|
||||
|
||||
update(row) {
|
||||
/** @param {string} */
|
||||
this.noteId = row.noteId;
|
||||
/** @param {string} */
|
||||
@@ -26,34 +53,11 @@ class Note {
|
||||
this.isProtected = !!row.isProtected;
|
||||
/** @param {boolean} */
|
||||
this.isDecrypted = !row.isProtected || !!row.isContentAvailable;
|
||||
/** @param {Branch[]} */
|
||||
this.parentBranches = [];
|
||||
/** @param {Note[]} */
|
||||
this.parents = [];
|
||||
/** @param {Note[]} */
|
||||
this.children = [];
|
||||
/** @param {Attribute[]} */
|
||||
this.ownedAttributes = [];
|
||||
|
||||
/** @param {Attribute[]|null} */
|
||||
this.attributeCache = null;
|
||||
/** @param {Attribute[]|null} */
|
||||
this.inheritableAttributeCache = null;
|
||||
|
||||
/** @param {Attribute[]} */
|
||||
this.targetRelations = [];
|
||||
this.decrypt();
|
||||
|
||||
/** @param {string|null} */
|
||||
this.flatTextCache = null;
|
||||
|
||||
this.noteCache.notes[this.noteId] = this;
|
||||
|
||||
if (protectedSessionService.isProtectedSessionAvailable()) {
|
||||
this.decrypt();
|
||||
}
|
||||
|
||||
/** @param {Note[]|null} */
|
||||
this.ancestorCache = null;
|
||||
}
|
||||
|
||||
/** @return {Attribute[]} */
|
||||
|
||||
Reference in New Issue
Block a user