Commit 915fc52a authored by hetech's avatar hetech Committed by GitHub

Tree: fix add node bug in lazy mode (#12265)

parent 7158ddc5
......@@ -285,11 +285,13 @@ export default class Node {
removeChildByData(data) {
let targetNode = null;
this.childNodes.forEach(node => {
if (node.data === data) {
targetNode = node;
for (let i = 0; i < this.childNodes.length; i++) {
if (this.childNodes[i] === data) {
targetNode = this.childNodes[i];
break;
}
}
});
if (targetNode) {
this.removeChild(targetNode);
......@@ -442,9 +444,11 @@ export default class Node {
}
});
if (!this.store.lazy) {
oldData.forEach((item) => {
if (!newDataMap[item[NODE_KEY]]) this.removeChildByData(item);
});
}
newNodes.forEach(({ index, data }) => {
this.insertChild({ data }, index);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment