Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
make `getAncestors` safe in respect to saved search
zadam7495777d97d1
diff --git a/src/becca/entities/note.js b/src/becca/entities/note.jsindex 2410d7a7fc..f966927ee2 100644--- a/src/becca/entities/note.js+++ b/src/becca/entities/note.js@@ -865,11 +865,13 @@ class Note extends AbstractEntity {this.ancestorCache = [];for (const parent of this.parents) {- if (!noteIds.has(parent.noteId)) {- this.ancestorCache.push(parent);- noteIds.add(parent.noteId);+ if (noteIds.has(parent.noteId)) {+ continue;}+ this.ancestorCache.push(parent);+ noteIds.add(parent.noteId);+for (const ancestorNote of parent.getAncestors()) {if (!noteIds.has(ancestorNote.noteId)) {this.ancestorCache.push(ancestorNote);