mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	continuing work on hoisting notes
This commit is contained in:
		| @@ -38,6 +38,7 @@ async function getNotes(noteIds) { | ||||
| async function getRelations(noteIds) { | ||||
|     // we need to fetch both parentNoteId and noteId matches because we can have loaded child | ||||
|     // of which only some of the parents has been loaded. | ||||
|     // also now with note hoisting, it is possible to have the note displayed without its parent chain being loaded | ||||
|  | ||||
|     const relations = await sql.getManyRows(`SELECT branchId, noteId AS 'childNoteId', parentNoteId, notePosition FROM branches WHERE isDeleted = 0  | ||||
|          AND (parentNoteId IN (???) OR noteId IN (???))`, noteIds); | ||||
| @@ -65,6 +66,9 @@ async function getTree() { | ||||
|           ) | ||||
|         SELECT branches.* FROM tree JOIN branches USING(noteId) WHERE branches.isDeleted = 0 ORDER BY branches.notePosition`, [hoistedNoteId]); | ||||
|  | ||||
|     // we also want root branch in there because all the paths start with root | ||||
|     branches.push(await sql.getRow(`SELECT * FROM branches WHERE branchId = 'root'`)); | ||||
|  | ||||
|     const noteIds = Array.from(new Set(branches.map(b => b.noteId))); | ||||
|  | ||||
|     const notes = await getNotes(noteIds); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user