Skip to content

Commit

Permalink
fix: ordering problem of the children by using shift instead of pop
Browse files Browse the repository at this point in the history
  • Loading branch information
Yanyan-Wang committed Aug 17, 2020
1 parent 1547950 commit 14e8875
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/layout/hierarchy.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ util.assign(Node.prototype, {
const me = this;
let nodes = [ me ];
let current;
while (current = nodes.pop()) {
while (current = nodes.shift()) {
callback(current);
nodes = nodes.concat(current.children);
}
Expand Down Expand Up @@ -152,7 +152,7 @@ function hierarchy(data, options = {}, isolated) {
const nodes = [ root ];
let node;
if (!isolated && !data.collapsed) {
while (node = nodes.pop()) {
while (node = nodes.shift()) {
if (!node.data.collapsed) {
const children = options.getChildren(node.data);
const length = children ? children.length : 0;
Expand Down

0 comments on commit 14e8875

Please sign in to comment.