Fix order of items
Reviewed By: lawrencelomax Differential Revision: D41838169 fbshipit-source-id: 2cc82eb1d50552de5f7970b61f6375d6ff8985fd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8784691e62
commit
88e2bb7607
@@ -29,6 +29,7 @@ import {
|
||||
import {plugin} from '../index';
|
||||
import {Glyph} from 'flipper';
|
||||
import {head} from 'lodash';
|
||||
import {reverse} from 'lodash/fp';
|
||||
|
||||
export function Tree2({
|
||||
nodes,
|
||||
@@ -255,12 +256,11 @@ function toTreeList(
|
||||
});
|
||||
|
||||
if (isExpanded) {
|
||||
for (const childId of cur.children) {
|
||||
//since we do dfs and use a stack we have to reverse children to get the order correct
|
||||
for (const childId of reverse(cur.children)) {
|
||||
const child = nodes.get(childId);
|
||||
if (child != null) {
|
||||
stack.push([child, depth + 1]);
|
||||
} else {
|
||||
console.log('null', childId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user