fixes for invalid operations on root note

This commit is contained in:
azivner
2018-10-21 22:42:20 +02:00
parent bfa2b5fa62
commit 0c007566ad
10 changed files with 51 additions and 9 deletions

View File

@@ -37,6 +37,11 @@ async function checkTreeCycles(errorList) {
return;
}
if (!childToParents[noteId] || childToParents[noteId].length === 0) {
errorList.push(`No parents found for noteId=${noteId}`);
return;
}
for (const parentNoteId of childToParents[noteId]) {
if (path.includes(parentNoteId)) {
errorList.push(`Tree cycle detected at parent-child relationship: ${parentNoteId} - ${noteId}, whole path: ${path}`);