This commit is contained in:
zadam
2020-06-27 00:40:35 +02:00
parent dd62b306fd
commit c778e87683
8 changed files with 44 additions and 41 deletions

View File

@@ -180,22 +180,9 @@ class NoteShort {
return [];
}
if (!(this.noteId in noteAttributeCache)) {
const ownedAttributes = this.getOwnedAttributes();
const attrArrs = [
ownedAttributes
];
if (!(this.noteId in noteAttributeCache.attributes)) {
const newPath = [...path, this.noteId];
for (const templateAttr of ownedAttributes.filter(oa => oa.type === 'relation' && oa.name === 'template')) {
const templateNote = this.treeCache.notes[templateAttr.value];
if (templateNote && templateNote.noteId !== this.noteId) {
attrArrs.push(templateNote.__getCachedAttributes(newPath));
}
}
const attrArrs = [ this.getOwnedAttributes() ];
if (this.noteId !== 'root') {
for (const parentNote of this.getParentNotes()) {
@@ -206,6 +193,14 @@ class NoteShort {
}
}
for (const templateAttr of attrArrs.flat().filter(attr => attr.type === 'relation' && attr.name === 'template')) {
const templateNote = this.treeCache.notes[templateAttr.value];
if (templateNote && templateNote.noteId !== this.noteId) {
attrArrs.push(templateNote.__getCachedAttributes(newPath));
}
}
noteAttributeCache.attributes[this.noteId] = attrArrs.flat();
}