From 21fab412cbd3d4abf22cf4ad427dc202820e7dee Mon Sep 17 00:00:00 2001 From: zadam Date: Tue, 17 Dec 2019 22:17:03 +0100 Subject: [PATCH] sync error mitigation --- src/routes/api/tree.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/routes/api/tree.js b/src/routes/api/tree.js index 7bf7901c6..eaa478f1b 100644 --- a/src/routes/api/tree.js +++ b/src/routes/api/tree.js @@ -10,6 +10,8 @@ async function getNotesAndBranches(noteIds) { noteIds = notes.map(n => n.noteId); + // joining child note to filter out not completely synchronised notes which would then cause errors later + // cannot do that with parent because of root note's 'none' parent const branches = await sql.getManyRows(` SELECT branches.branchId, @@ -19,6 +21,7 @@ async function getNotesAndBranches(noteIds) { branches.prefix, branches.isExpanded FROM branches + JOIN notes AS child ON child.noteId = branches.noteId WHERE branches.isDeleted = 0 AND (branches.noteId IN (???) OR parentNoteId IN (???))`, noteIds);