continuing work on hoisting notes

This commit is contained in:
azivner
2018-12-12 20:39:56 +01:00
parent 6fbf28b30d
commit 17d030e800
4 changed files with 27 additions and 9 deletions

View File

@@ -12,8 +12,16 @@ async function prepareTree(noteRows, branchRows, relations) {
treeCache.load(noteRows, branchRows, relations);
const hoistedNoteId = await hoistedNoteService.getHoistedNoteId();
const hoistedNote = await treeCache.getNote(hoistedNoteId);
const hoistedBranch = (await hoistedNote.getBranches())[0];
let hoistedBranch;
if (hoistedNoteId === 'root') {
hoistedBranch = await treeCache.getBranch('root');
}
else {
const hoistedNote = await treeCache.getNote(hoistedNoteId);
hoistedBranch = (await hoistedNote.getBranches())[0];
}
return [ await prepareNode(hoistedBranch) ];
}