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 duplicating relations after change, closes #1405
zadamd5a9abd9114e
diff --git a/src/routes/api/attributes.js b/src/routes/api/attributes.jsindex 8de30e9c47..345ecfae43 100644--- a/src/routes/api/attributes.js+++ b/src/routes/api/attributes.js@@ -28,8 +28,10 @@ function updateNoteAttribute(req) {|| body.name !== attribute.name|| (body.type === 'relation' && body.value !== attribute.value)) {+ let newAttribute;+if (body.type !== 'relation' || !!body.value.trim()) {- const newAttribute = attribute.createClone(body.type, body.name, body.value);+ newAttribute = attribute.createClone(body.type, body.name, body.value);newAttribute.save();}@@ -37,7 +39,7 @@ function updateNoteAttribute(req) {attribute.save();return {- attributeId: attribute.attributeId+ attributeId: newAttribute ? newAttribute.attributeId : null};}}