Skip to content

Build your personal knowledge base with Trilium Notes

fix checking affected notes when modified attribute's owning note is not loaded into cache, #803

zadam3d324b954d89
diff --git a/src/public/app/entities/attribute.js b/src/public/app/entities/attribute.js
index 91b8044da1..f6471f355d 100644
--- a/src/public/app/entities/attribute.js
+++ b/src/public/app/entities/attribute.js
@@ -52,7 +52,17 @@ class Attribute {
* 3. attribute is owned by some note's ancestor and is inheritable
*/
isAffecting(affectedNote) {
+ if (!affectedNote) {
+ return false;
+ }
+
const attrNote = this.getNote();
+
+ if (!attrNote) {
+ // the note (owner of the attribute) is not even loaded into the cache so it should not affect anything else
+ return false;
+ }
+
const owningNotes = [affectedNote, ...affectedNote.getTemplateNotes()];
for (const owningNote of owningNotes) {