From d89dd24f2755d92fd87f96d9548b9a82ca316409 Mon Sep 17 00:00:00 2001 From: Tim Zallmann Date: Thu, 22 Jun 2017 14:38:37 +0200 Subject: Rephrased comments + removed unnecessary comments --- app/assets/javascripts/groups/stores/groups_store.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/groups/stores/groups_store.js b/app/assets/javascripts/groups/stores/groups_store.js index dcf582b6900..6eab6083e8f 100644 --- a/app/assets/javascripts/groups/stores/groups_store.js +++ b/app/assets/javascripts/groups/stores/groups_store.js @@ -63,9 +63,7 @@ export default class GroupsStore { } else if (parentGroup && parentGroup.id === currentGroup.parentId) { tree[`id${currentGroup.id}`] = currentGroup; } else { - // No parent found. We save it for later processing. - // We should put it inside a group where it's contained. - // e.g. If this group is `one / two / three` we are going to put it inside `one` + // No parent found. We save it for later processing orphans.push(currentGroup); // Add to tree to preserve original order @@ -79,7 +77,6 @@ export default class GroupsStore { return key; }); - // Hopefully this array will be empty for most cases if (orphans.length) { orphans.map((orphan) => { let found = false; @@ -89,11 +86,10 @@ export default class GroupsStore { const group = tree[key]; if ( - // Make sure `group` exists since it can be deleted below group && currentOrphan.fullPath.lastIndexOf(group.fullPath) === 0 && - // Make sure is not the same we are not comparing the same group. - // If we don't do this it will cause and infinite loop when rendering on vue + // Make sure the currently selected orphan is not the same as the group + // we are checking here otherwise it will end up in an infinite loop currentOrphan.id !== group.id ) { group.subGroups[currentOrphan.id] = currentOrphan; -- cgit v1.2.1