fix(Tree): fix the error caused by changing data in multi-select mode

This commit is contained in:
xzdry 2022-10-19 14:23:56 +08:00
parent 819dad3ada
commit d1cfc023a3

View File

@ -137,10 +137,14 @@ export const Tree = implementRuntimeComponent({
e: Event;
}
) => {
const selectNodes = extra.selectedNodes.map(node => formatNode(node.props));
// In multi-select mode, select an item, remove it from data, and select an item again. Two items will be selected at the same time
// Think it's a bug in the arco tree
const selectNodes = extra.selectedNodes
.filter(node => node)
.map(node => formatNode(node.props));
mergeState({
selectedKeys,
selectedKeys: selectNodes.map(node => node.key),
selectedNode: selectNodes[0],
selectedNodes: selectNodes,
});