mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	hoisting notes WIP
This commit is contained in:
		| @@ -50,18 +50,20 @@ async function getRelations(noteIds) { | ||||
| } | ||||
|  | ||||
| async function getTree() { | ||||
|     const hoistedNoteId = await optionService.getOption('hoistedNoteId'); | ||||
|  | ||||
|     // we fetch all branches of notes, even if that particular branch isn't visible | ||||
|     // this allows us to e.g. detect and properly display clones | ||||
|     const branches = await sql.getRows(` | ||||
|         WITH RECURSIVE | ||||
|             tree(branchId, noteId, isExpanded) AS ( | ||||
|             SELECT branchId, noteId, isExpanded FROM branches WHERE branchId = 'root'  | ||||
|             SELECT branchId, noteId, isExpanded FROM branches WHERE noteId = ?  | ||||
|             UNION ALL | ||||
|             SELECT branches.branchId, branches.noteId, branches.isExpanded FROM branches | ||||
|               JOIN tree ON branches.parentNoteId = tree.noteId | ||||
|               WHERE tree.isExpanded = 1 AND branches.isDeleted = 0 | ||||
|           ) | ||||
|         SELECT branches.* FROM tree JOIN branches USING(noteId) WHERE branches.isDeleted = 0 ORDER BY branches.notePosition`); | ||||
|         SELECT branches.* FROM tree JOIN branches USING(noteId) WHERE branches.isDeleted = 0 ORDER BY branches.notePosition`, [hoistedNoteId]); | ||||
|  | ||||
|     const noteIds = Array.from(new Set(branches.map(b => b.noteId))); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user