From 14ced949a9210352a4b04fc48e47609bab006cdb Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 2 Mar 2021 23:10:42 +0100 Subject: [PATCH] fix modifying index in note cache when deleting attribute, closes #1706 --- src/services/note_cache/note_cache_loader.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/note_cache/note_cache_loader.js b/src/services/note_cache/note_cache_loader.js index 0d53ea020..336deee5f 100644 --- a/src/services/note_cache/note_cache_loader.js +++ b/src/services/note_cache/note_cache_loader.js @@ -120,7 +120,11 @@ eventService.subscribe([eventService.ENTITY_CHANGED, eventService.ENTITY_DELETED delete noteCache.attributes[attributeId]; if (attr) { - delete noteCache.attributeIndex[`${attr.type}-${attr.name.toLowerCase()}`]; + const key = `${attr.type}-${attr.name.toLowerCase()}`; + + if (key in noteCache.attributeIndex) { + noteCache.attributeIndex[key] = noteCache.attributeIndex[key].filter(attr => attr.attributeId !== attributeId); + } } } else if (attributeId in noteCache.attributes) {