fluentui-blazor
fluentui-blazor copied to clipboard
FluentCombobox OnValueChanged is called twice when the item selected has more than one space in the middle of the items string or an extra space at the beginning or end of the string.
🐛 Bug Report
FluentCombobox OnValueChanged is called twice when the item selected has more than one space in the middle of the items string or an extra space at the beginning or end of the string.
When OnValueChanged is called twice, the function is reentered a second time prior to the first call being completed.
This cannot be fixed in user code without elaborate workarounds when data comes from a database or other source.
💻 Repro or Code Sample
@page "/test"
<FluentCombobox Items="@_items" ValueChanged="@OnValueChanged" />
@code
{
private List<string> _items = ["good", "good good", "bad bad", "bad ", " bad"];
private async Task OnValueChanged(string? value)
{
Debug.WriteLine($"Start: '{value}')");
await Task.Delay(100);
Debug.WriteLine($"End: '{value}')");
}
}
🤔 Expected Behavior
When you select 'good' you get this expected output in the Output window:
Start: 'good')
End: 'good')
When you select 'good good' you get this expected output in the Output window:
Start: 'good good')
End: 'good good')
😯 Current Behavior
When you select 'bad bad' you get this unexpected output in the Output window:
Start: 'bad bad')
Start: 'bad bad')
End: 'bad bad')
End: 'bad bad')
When you select 'bad ' you get this unexpected output in the Output window:
Start: 'bad')
Start: 'bad ')
End: 'bad ')
End: 'bad')
When you select ' bad' you get this unexpected output in the Output window:
Start: 'bad')
Start: ' bad')
End: 'bad')
End: ' bad')
🌍 Your Environment
.NET 8 Fluent UI Blazor library Version 4.10.2 Blazor Server Microsoft Edge for Business Version 130.0.2849.52 (Official build) (64-bit)
Fixed with PR mentioned above. Will be in nex release