From d4470d16af9da01828b0654317a150670044b6c5 Mon Sep 17 00:00:00 2001 From: Tom Herold Date: Thu, 11 Jul 2019 14:50:41 +0200 Subject: [PATCH] fixed expand all trees bug #4162 --- .../oxalis/view/right-menu/tree_hierarchy_view.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/javascripts/oxalis/view/right-menu/tree_hierarchy_view.js b/frontend/javascripts/oxalis/view/right-menu/tree_hierarchy_view.js index d111a08b104..ed635eadbd6 100644 --- a/frontend/javascripts/oxalis/view/right-menu/tree_hierarchy_view.js +++ b/frontend/javascripts/oxalis/view/right-menu/tree_hierarchy_view.js @@ -181,18 +181,23 @@ class TreeHierarchyView extends React.PureComponent { }; setExpansionOfAllSubgroupsTo = (groupId: number, expanded: boolean) => { + const newExpandedGroupIds = Object.assign({}, this.state.expandedGroupIds); const collapseAllGroups = groupTree => { const copyOfGroupTree = _.cloneDeep(groupTree); findTreeNode(copyOfGroupTree, groupId, item => { forEachTreeNode(item.children, node => { if (node.type === TYPE_GROUP) { node.expanded = expanded; + newExpandedGroupIds[node.id] = expanded; } }); }); return copyOfGroupTree; }; - this.setState(prevState => ({ groupTree: collapseAllGroups(prevState.groupTree) })); + this.setState(prevState => ({ + groupTree: collapseAllGroups(prevState.groupTree), + expandedGroupIds: newExpandedGroupIds, + })); }; onMoveNode = (params: {