Skip to content

Commit

Permalink
fix: preserve node order in swapwithparents
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinL committed Dec 8, 2021
1 parent 6299dd8 commit 9460999
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/compile/data/dataflow.ts
Expand Up @@ -116,11 +116,14 @@ export abstract class DataFlowNode {
// remove old links
this._children = []; // equivalent to removing every child link one by one
parent.removeChild(this);
parent.parent.removeChild(parent);
const loc = parent.parent.removeChild(parent);

// swap two nodes
this.parent = newParent;
parent.parent = this;
this._parent = newParent;
newParent.addChild(this, loc);

parent._parent = this
this.addChild(parent, loc);
}
}

Expand Down

0 comments on commit 9460999

Please sign in to comment.