fix(tree-select): 删除父节点的最后一个子节点后选中了另外的子节点. #3508 #3586
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
这个变动的性质是
需求背景
删除父节点的最后一个子节点后选中了另外的子节点, 相关issue: #3508
实现方案和 API(非新功能可选)
原因:
isPosRelated方法判断节点的关系时,只判断了父子节点,没有判断兄弟节点,e.g. 1-2-3 related with 1-2-4
看了rc-tree-select,新版已经采用hooks来重写了,没这问题。
2.9.x版本有问题,可以看:http://react-component.github.io/tree-select/examples/basic.html
修复方式:isPosRelated增加对兄弟节点的判断,兄弟节点的关系返回true
影响范围:只在onMultipleSelectorRemove,删除节点的情况下采用
请求合并前的自查清单