Skip to content

Commit e7914fc

Browse files
holson1bkrem
authored andcommitted
Fixes initialDepth regression (#103, fixes #99)
1 parent c8a9e3a commit e7914fc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Tree/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,12 @@ export default class Tree extends React.Component {
313313
.children(d => (d._collapsed ? null : d._children));
314314

315315
const rootNode = this.state.data[0];
316-
const nodes = tree.nodes(rootNode);
317-
const links = tree.links(nodes);
316+
let nodes = tree.nodes(rootNode);
318317

319318
// set `initialDepth` on first render if specified
320319
if (initialDepth !== undefined && this.internalState.initialRender) {
321320
this.setInitialTreeDepth(nodes, initialDepth);
321+
nodes = tree.nodes(rootNode);
322322
}
323323

324324
if (depthFactor) {
@@ -327,6 +327,7 @@ export default class Tree extends React.Component {
327327
});
328328
}
329329

330+
const links = tree.links(nodes);
330331
return { nodes, links };
331332
}
332333

0 commit comments

Comments
 (0)