fix(module: tree-select): exception when searching with nodes have no title (#4024)

* fix(module: tree-select): exception when searching with nodes have no title

* fix focus
This commit is contained in:
James Yeung 2024-07-26 00:01:15 +08:00 committed by GitHub
parent 643ca11850
commit 58a499f8bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View File

@ -397,6 +397,8 @@ namespace AntDesign
return;
var node = args.Node;
_searchValue = string.Empty;
var key = node.Key;
if (Multiple)
{
@ -421,6 +423,11 @@ namespace AntDesign
{
await CloseAsync();
}
if (EnableSearch)
{
await SetInputFocusAsync();
}
}

View File

@ -526,7 +526,7 @@ namespace AntDesign
}
else if (!string.IsNullOrWhiteSpace(_searchValue))
{
searchDatas = allList.Where(x => x.Title.Contains(_searchValue, StringComparison.InvariantCultureIgnoreCase)).ToList();
searchDatas = allList.Where(x => !string.IsNullOrEmpty(x.Title) && x.Title.Contains(_searchValue, StringComparison.InvariantCultureIgnoreCase)).ToList();
}
if (searchDatas != null && searchDatas.Any())