Skip to content

Build your personal knowledge base with Trilium Notes

refactor(hidden_subtree): deduplicate restoring title

Elian Doran055e11174d98
diff --git a/apps/server/src/services/hidden_subtree.ts b/apps/server/src/services/hidden_subtree.ts
index 5aacf1756d..ec69f0154a 100644
--- a/apps/server/src/services/hidden_subtree.ts
+++ b/apps/server/src/services/hidden_subtree.ts
@@ -383,12 +383,6 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
}
}
}
-
- if (item.id.startsWith("_lb") && note.title !== item.title) {
- // If the note title is different from the expected title, update it
- note.title = item.title;
- note.save();
- }
}
const attrs = [...(item.attributes || [])];
@@ -419,7 +413,8 @@ function checkHiddenSubtreeRecursively(parentNoteId: string, item: HiddenSubtree
}
}
- if ((extraOpts.restoreNames || note.noteId.startsWith("_help")) && note.title !== item.title) {
+ const shouldRestoreNames = extraOpts.restoreNames || note.noteId.startsWith("_help") || item.id.startsWith("_lb");
+ if (shouldRestoreNames && note.title !== item.title) {
note.title = item.title;
note.save();
}