Skip to content

Commit

Permalink
Fixes initialDepth regression (#103, fixes #99)
Browse files Browse the repository at this point in the history
  • Loading branch information
holson1 authored and bkrem committed May 10, 2018
1 parent c8a9e3a commit e7914fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Tree/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,12 @@ export default class Tree extends React.Component {
.children(d => (d._collapsed ? null : d._children));

const rootNode = this.state.data[0];
const nodes = tree.nodes(rootNode);
const links = tree.links(nodes);
let nodes = tree.nodes(rootNode);

// set `initialDepth` on first render if specified
if (initialDepth !== undefined && this.internalState.initialRender) {
this.setInitialTreeDepth(nodes, initialDepth);
nodes = tree.nodes(rootNode);
}

if (depthFactor) {
Expand All @@ -327,6 +327,7 @@ export default class Tree extends React.Component {
});
}

const links = tree.links(nodes);
return { nodes, links };
}

Expand Down

0 comments on commit e7914fc

Please sign in to comment.