Skip to content

Commit

Permalink
Code refinement
Browse files Browse the repository at this point in the history
  • Loading branch information
cheton committed Jan 31, 2018
1 parent 7c85187 commit cac5471
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/infinite-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ class InfiniteTree extends events.EventEmitter {
const nodeIndex = this.nodes.indexOf(node);

const fn = () => {
node.state.open = true; // Set node.state.open to true
node.state.open = true;

if (this.state.openNodes.indexOf(node) < 0) {
// the most recently used items first
Expand Down Expand Up @@ -1065,7 +1065,11 @@ class InfiniteTree extends events.EventEmitter {

if (nodes.length === 0 && currentNodeIndex >= 0) {
node.state.open = true;
this.state.openNodes = [node].concat(this.state.openNodes);

if (this.state.openNodes.indexOf(node) < 0) {
// the most recently used items first
this.state.openNodes = [node].concat(this.state.openNodes);
}
}

if (err || nodes.length === 0) {
Expand Down

0 comments on commit cac5471

Please sign in to comment.