fix(tree-select): avoid incorrect node selection when value is empty (#16898)

### Summary

fix(tree-select): avoid incorrect node selection when value is empty

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
chanx
2026-07-14 15:53:54 +08:00
committed by GitHub
parent ee142794ac
commit e5bc644c18

View File

@@ -67,7 +67,7 @@ export function TreeSelect({
const selectedNode = useMemo(() => {
const find = (nodes: TreeSelectNode[]): TreeSelectNode | undefined => {
for (const node of nodes) {
if (node.id === value) return node;
if (node.id === value && value) return node;
if (node.children) {
const found = find(node.children);
if (found) return found;