diff --git a/app/assets/javascripts/groups/stores/groups_store.js b/app/assets/javascripts/groups/stores/groups_store.js index bf43441bd712b66b39ca5049d3b64db26f90f981..1bfd87454232a50f239f60b8352e2390a85477ae 100644 --- a/app/assets/javascripts/groups/stores/groups_store.js +++ b/app/assets/javascripts/groups/stores/groups_store.js @@ -33,7 +33,8 @@ export default class GroupsStore { Object.keys(mappedGroups).forEach((key) => { const currentGroup = mappedGroups[key]; // If the group is not at the root level, add it to its parent array of subGroups. - if (currentGroup.parentId) { + const parentGroup = mappedGroups[currentGroup['parentId']]; + if (currentGroup.parentId && parentGroup) { mappedGroups[currentGroup.parentId].subGroups[currentGroup.id] = currentGroup; mappedGroups[currentGroup.parentId].isOpen = true; // Expand group if it has subgroups } else {