fix modifying index in note cache when deleting attribute, closes #1706

This commit is contained in:
zadam 2021-03-02 23:10:42 +01:00
parent 5b5c2a2dbb
commit 14ced949a9

View file

@ -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) {