phphe/he-tree

Bug: removeMulti(...) cannot delete all data at one time.

kermitmei opened this issue · 2 comments

翻译如下:

I have found a bug where removeMulti cannot delete all the submitted data at once, for example:

menuTree.value?.removeMulti(parentNode?.children);

If parentNode?.children has multiple data entries, it can only delete most of them each time. This forces me to write my code like this:

console.log('parentNode A-> ', parentNode);
while (parentNode?.children && parentNode?.children.length > 0) {
  menuTree.value?.removeMulti(parentNode?.children);
}
console.log('parentNode B-> ', parentNode);
menuTree.value?.addMulti(locatedNode.node.children, parentNode, 0);

This means that if parentNode?.children contains multiple items, the function removeMulti is only able to remove most of them in a single call. As a result, I have to use a loop to repeatedly call removeMulti until parentNode?.children is empty. After that, I log the state of parentNode before and after the deletion process, and then I add multiple child nodes to parentNode using addMulti.

fixed, try 2.8.3

fixed, try 2.8.3

Thanks, it works!