Skip to content

Build your personal knowledge base with Trilium Notes

feat(in-app-help): update docName attribute if it got changed

Elian Doran61ee15cc01e3
diff --git a/src/services/hidden_subtree.ts b/src/services/hidden_subtree.ts
index bf5af3fa73..d15738e2f5 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();
}
}