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
fix modifying index in note cache when deleting attribute, closes #1706
zadam14ced949a921
diff --git a/src/services/note_cache/note_cache_loader.js b/src/services/note_cache/note_cache_loader.jsindex 0d53ea0200..336deee5ff 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_DELETEDdelete 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) {