From 61ee15cc01e3750e2c05512d309a6e29d59b7b63 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 2 Feb 2025 15:32:28 +0200 Subject: [PATCH] feat(in-app-help): update docName attribute if it got changed --- src/services/hidden_subtree.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/hidden_subtree.ts b/src/services/hidden_subtree.ts index bf5af3fa7..d15738e2f 100644 --- a/src/services/hidden_subtree.ts +++ b/src/services/hidden_subtree.ts @@ -458,7 +458,9 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree for (const attr of attrs) { const attrId = note.noteId + "_" + attr.type.charAt(0) + attr.name; - if (!note.getAttributes().find((attr) => attr.attributeId === attrId)) { + const existingAttribute = note.getAttributes().find((attr) => attr.attributeId === attrId); + + if (!existingAttribute) { new BAttribute({ attributeId: attrId, noteId: note.noteId, @@ -467,6 +469,10 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree value: attr.value, isInheritable: false }).save(); + } else if (attr.name === "docName") { + // Updating docname + existingAttribute.value = attr.value ?? ""; + existingAttribute.save(); } }