From 3d324b954d89bf3366dcabfec36fd4d38d8174cd Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 15 Jul 2020 22:36:27 +0200 Subject: [PATCH] fix checking affected notes when modified attribute's owning note is not loaded into cache, #803 --- src/public/app/entities/attribute.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/public/app/entities/attribute.js b/src/public/app/entities/attribute.js index 91b8044da..f6471f355 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) {