Skip to content

Build your personal knowledge base with Trilium Notes

fix root branch

zadam35e47f866a34
diff --git a/src/routes/api/tree.js b/src/routes/api/tree.js
index 3a5a4b21b6..2a36b40b0c 100644
--- a/src/routes/api/tree.js
+++ b/src/routes/api/tree.js
@@ -26,6 +26,17 @@ function getNotesAndBranchesAndAttributes(noteIds) {
JOIN notes AS child ON child.noteId = branches.noteId
WHERE branches.isDeleted = 0`);
+ if (noteIds.has('root')) {
+ branches.push({
+ branchId: 'root',
+ noteId: 'root',
+ parentNoteId: 'none',
+ notePosition: 0,
+ prefix: '',
+ isExpanded: true
+ });
+ }
+
const attributes = sql.getRows(`
SELECT
attributes.attributeId,