fixes for undefined parent note #3066

This commit is contained in:
zadam
2022-08-16 23:46:56 +02:00
parent 78bca2477d
commit 8abcf571e8
4 changed files with 7 additions and 5 deletions

View File

@@ -699,9 +699,11 @@ class Note extends AbstractEntity {
sortParents() {
this.parentBranches.sort((a, b) =>
a.branchId.startsWith('virt-')
|| a.parentNote.hasInheritableOwnedArchivedLabel() ? 1 : -1);
|| a.parentNote?.hasInheritableOwnedArchivedLabel() ? 1 : -1);
this.parents = this.parentBranches.map(branch => branch.parentNote);
this.parents = this.parentBranches
.map(branch => branch.parentNote)
.filter(note => !!note);
}
/**