🐛 Bug Report
PR #4735 introduced the OnSetValue callback to the FluentAutocomplete. Initial values aren't respected by the component right now.
In addition if you use an async callback then it will be executed over and over again.
💻 Repro or Code Sample
Update the debug page to use an initialized value.
int? SelectedUserId { get; set; } = 3;
Notice that the component won't show the item on page load.
To test the async code update the example to:
<FluentAutocomplete TOption="User"
TValue="int?"
Width="100%"
Label="@($"Bind to an Int32 (SelectedUserId: {SelectedUserId})")"
Multiple="false"
OnOptionsSearch="@(args => { args.Items = User.GetUsers().Where(u => u.Name.StartsWith(args.Text, StringComparison.OrdinalIgnoreCase)); return Task.CompletedTask; })"
OnSetValue="@(async (args) =>
{ // Put a debug point here
await Task.Delay(20);
args.Item = User.GetUsers().FirstOrDefault(u => u.Id == args.Value);
})"
OptionText="@(item => item?.Name)"
OptionValue="@(item => item?.Id)"
@bind-Value="@SelectedUserId" />
🤔 Expected Behavior
The value should be shown on page load and the async method should only run once.
😯 Current Behavior
- The value is only shown once you click on the component.
- The async method will be executed over and over again
🐛 Bug Report
PR #4735 introduced the
OnSetValuecallback to theFluentAutocomplete. Initial values aren't respected by the component right now.In addition if you use an
asynccallback then it will be executed over and over again.💻 Repro or Code Sample
Update the debug page to use an initialized value.
Notice that the component won't show the item on page load.
To test the async code update the example to:
🤔 Expected Behavior
The value should be shown on page load and the async method should only run once.
😯 Current Behavior