We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3445b76 commit 4a86773Copy full SHA for 4a86773
1 file changed
src/BootstrapBlazor/Components/Select/Select.razor.cs
@@ -491,10 +491,14 @@ private async Task OnChange(ChangeEventArgs args)
491
492
private SelectedItem? GetItemByRows()
493
{
494
+ // 修复:使用完整的未过滤列表来查找当前选中项
495
+ // 避免在用户搜索时被外部 StateHasChanged 影响导致值被错误修改
496
+ var allItems = GetRowsByItems();
497
+
498
var item = GetItemWithEnumValue()
- ?? Rows.Find(i => i.Value == CurrentValueAsString)
- ?? Rows.Find(i => i.Active)
- ?? Rows.Find(i => !i.IsDisabled);
499
+ ?? allItems.Find(i => i.Value == CurrentValueAsString)
500
+ ?? allItems.Find(i => i.Active)
501
+ ?? allItems.Find(i => !i.IsDisabled);
502
return item;
503
}
504
0 commit comments