From 14787e0283d4dc4ff445cec82ea875d61b745aa2 Mon Sep 17 00:00:00 2001 From: azivner Date: Sun, 19 Nov 2017 16:43:49 -0500 Subject: [PATCH] note expansion fix --- public/javascripts/note_tree.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js index d50eada68..9441b3a93 100644 --- a/public/javascripts/note_tree.js +++ b/public/javascripts/note_tree.js @@ -95,6 +95,11 @@ const noteTree = (function() { function prepareNoteTreeInner(parentNoteId) { const childNoteIds = parentToChildren[parentNoteId]; + if (!childNoteIds) { + console.log("No children for " + noteId + ". This shouldn't happen."); + return; + } + const noteList = []; for (const childNoteId of childNoteIds) { @@ -327,14 +332,8 @@ const noteTree = (function() { }, lazyLoad: function(event, data){ const node = data.node.data; - const noteTreeId = node.note_tree_id; - if (parentToChildren[noteTreeId]) { - data.result = prepareNoteTreeInner(parentToChildren[noteTreeId]); - } - else { - console.log("No children for " + noteTreeId + ". This shouldn't happen."); - } + data.result = prepareNoteTreeInner(node.note_id); } });