mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
fix tree loading (partial revert of previous commit)
This commit is contained in:
parent
c4acecd510
commit
6517188b39
@ -54,14 +54,15 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
|||||||
function getTree(req) {
|
function getTree(req) {
|
||||||
const subTreeNoteId = req.query.subTreeNoteId || optionService.getOption('hoistedNoteId');
|
const subTreeNoteId = req.query.subTreeNoteId || optionService.getOption('hoistedNoteId');
|
||||||
|
|
||||||
|
// FIXME: this query does not return ascendants of template notes
|
||||||
const noteIds = sql.getColumn(`
|
const noteIds = sql.getColumn(`
|
||||||
WITH RECURSIVE
|
WITH RECURSIVE
|
||||||
treeWithDescendants(noteId) AS (
|
treeWithDescendants(noteId, isExpanded) AS (
|
||||||
SELECT noteId FROM branches WHERE parentNoteId = ? AND isDeleted = 0
|
SELECT noteId, isExpanded FROM branches WHERE parentNoteId = ? AND isDeleted = 0
|
||||||
UNION
|
UNION
|
||||||
SELECT branches.noteId FROM branches
|
SELECT branches.noteId, branches.isExpanded FROM branches
|
||||||
JOIN treeWithDescendants ON branches.parentNoteId = treeWithDescendants.noteId
|
JOIN treeWithDescendants ON branches.parentNoteId = treeWithDescendants.noteId
|
||||||
WHERE branches.isExpanded = 1
|
WHERE treeWithDescendants.isExpanded = 1
|
||||||
AND branches.isDeleted = 0
|
AND branches.isDeleted = 0
|
||||||
),
|
),
|
||||||
treeWithDescendantsAndAscendants AS (
|
treeWithDescendantsAndAscendants AS (
|
||||||
@ -83,7 +84,7 @@ function getTree(req) {
|
|||||||
)
|
)
|
||||||
SELECT noteId FROM treeWithDescendantsAscendantsAndTemplates`, [subTreeNoteId, subTreeNoteId]);
|
SELECT noteId FROM treeWithDescendantsAscendantsAndTemplates`, [subTreeNoteId, subTreeNoteId]);
|
||||||
|
|
||||||
noteIds.push(subTreeNoteId);
|
noteIds.push(subTreeNoteId);console.log("noteIds", noteIds);
|
||||||
|
|
||||||
return getNotesAndBranchesAndAttributes(noteIds);
|
return getNotesAndBranchesAndAttributes(noteIds);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user