Skip to content

Commit

Permalink
fix: make all nodes in scenario manager expanded by default
Browse files Browse the repository at this point in the history
  • Loading branch information
nborde-CSM committed Mar 22, 2022
1 parent 439810d commit a3c41c4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/charts/ScenarioManagerTreeList/ScenarioManagerTreeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import useStyles from './style';
import { ScenarioNode } from '../../cards';
import { SHRUNK_NODE_HEIGHT, EXPANDED_NODE_HEIGHT } from '../../cards/ScenarioNode/constants';

const initNodesDict = (scenarios) => {
const initNodesDict = (scenarios, defaultExpanded) => {
const nodesDict = {};
scenarios.forEach((scenario) => {
nodesDict[scenario.id] = false;
nodesDict[scenario.id] = defaultExpanded;
});
return nodesDict;
};
Expand All @@ -43,8 +43,8 @@ export const ScenarioManagerTreeList = (props) => {

// Memoize the full scenarios tree in a ReactSortableTree-compatible format
const [searchText, setSearchText] = useState('');
const [nodesExpandedChildren, setNodesExpandedChildren] = useState(initNodesDict(scenarios));
const [nodesExpandedDetails, setNodesExpandedDetails] = useState(initNodesDict(scenarios));
const [nodesExpandedChildren, setNodesExpandedChildren] = useState(initNodesDict(scenarios, true));
const [nodesExpandedDetails, setNodesExpandedDetails] = useState(initNodesDict(scenarios, false));

const collapseAll = () => {
const newValue = {};
Expand Down

0 comments on commit a3c41c4

Please sign in to comment.