Skip to content

Commit fcb3106

Browse files
[ListBaseComponent] Fix for default selection options (#4135)
1 parent 2ee2cc2 commit fcb3106

2 files changed

Lines changed: 2 additions & 3 deletions

File tree

src/Core/Components/List/FluentCombobox.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected override async Task ChangeHandlerAsync(ChangeEventArgs e)
167167
{
168168
if (SelectedOption != null)
169169
{
170-
return OptionText.Invoke(SelectedOption) ?? OptionValue.Invoke(SelectedOption) ?? SelectedOption.ToString();
170+
return OptionText.Invoke(SelectedOption) ?? OptionValue?.Invoke(SelectedOption) ?? SelectedOption.ToString();
171171
}
172172
else
173173
{

src/Core/Components/List/ListComponentBase.razor.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected string? InternalValue
115115
/// Only for <see cref="FluentListbox{TOption}"/> and <see cref="FluentSelect{TOption}"/> components.
116116
/// </summary>
117117
[Parameter]
118-
public virtual Func<TOption, string?> OptionValue { get; set; }
118+
public virtual Func<TOption, string?>? OptionValue { get; set; }
119119

120120
/// <summary>
121121
/// Gets or sets the function used to determine if an option is disabled.
@@ -220,7 +220,6 @@ protected ListComponentBase()
220220
Id = Identifier.NewId();
221221

222222
OptionText = (item) => item?.ToString() ?? null;
223-
OptionValue = (item) => OptionText.Invoke(item) ?? item?.ToString() ?? null;
224223

225224
_renderOptions = RenderOptions;
226225
}

0 commit comments

Comments
 (0)