fixes in tree loading

This commit is contained in:
azivner 2018-08-12 12:59:38 +02:00
parent af4ea66742
commit 27be3b4c90
3 changed files with 5 additions and 5 deletions

View File

@ -51,12 +51,12 @@ class TreeCache {
if (!this.notes[noteId]) {
messagingService.logError(`Can't find note ${noteId}`);
return `[unknown ${noteId}]`;
return null;
}
else {
return this.notes[noteId];
}
});
}).filter(note => note !== null);
}
/** @return NoteShort */

View File

@ -35,9 +35,9 @@ async function getTree() {
JOIN tree ON branches.parentNoteId = tree.noteId
WHERE tree.isExpanded = 1 AND branches.isDeleted = 0
)
SELECT branches.* FROM tree JOIN branches USING(noteId) ORDER BY branches.notePosition`);
SELECT branches.* FROM tree JOIN branches USING(noteId) WHERE branches.isDeleted = 0 ORDER BY branches.notePosition`);
const noteIds = branches.map(b => b.noteId);
const noteIds = Array.from(new Set(branches.map(b => b.noteId)));
const notes = await getNotes(noteIds);

View File

@ -29,7 +29,7 @@ async function executeBundle(bundle, startNote, originEntity = null) {
return await execute(ctx, script, '');
}
else {
return await sql.transactional(async () => execute(ctx, script, ''));
return await sql.transactional(async () => await execute(ctx, script, ''));
}
}