Skip to content

fix: Value not updated in ListComponentBase controls #3416

@joriverm

Description

@joriverm

🐛 Bug Report

i was just made aware of my coworker who was updating fluent that in the combobox updating the SelectedOption no longer updated the Value parameter of the control. after some searching we found the fix of #3297 ( #3300 ) to have caused it.
the new boolean makes it so updates to the selection from code doesn't make it change the value.

we are currently looking for a solution that fixes both the loop and makes it update value, but if anyone has an idea, fire away :)

💻 Repro or Code Sample

the following code was put in the issue tester :

@inject DataSource Data

<FluentCombobox Items="@Data.People"
                OptionValue="@(i => i.PersonId.ToString())"
                OptionText="@(i => $"{i.FirstName} ({i.LastName})")"
                @bind-Value="@value"
                @bind-SelectedOption=@Person>
    <OptionTemplate>
        <FluentIcon Value="@(new Icons.Regular.Size16.Person())" Slot="end" OnClick="@(() => DemoLogger.WriteLine($"Icon for {@context?.LastName} selected"))" />
        @context?.FirstName (@context?.LastName)
    </OptionTemplate>
</FluentCombobox>

<FluentButton OnClick=@(() => {Person = null;})>Clear</FluentButton>
<FluentButton OnClick=@(() => {Person = Data.People.First();})>Select First</FluentButton>
<p>
    Selected option: @Person <br />
    Selected value: @value
</p>

@code {
    public Person? Person { get; set; } = default!;
    public string? value;
}

🤔 Expected Behavior

when one of the buttons is pressed the Value should be updated

😯 Current Behavior

Value (and the control's current-value) is not updated

💁 Possible Solution

undoing the boolean fixes it and doesnt seem to cause it to loop again, however we arent sure this is the correct fix. so maybe we need to do some hybrid parameter set or look if its already in the process of updating?

🔦 Context

We are currently porting some formbuilder to blazor and conditional values have broken because of the bug.

🌍 Your Environment

  • OS & Device: Windows 10
  • Browser: Chrome
  • .NET and Fluent UI Blazor library Version: Net8 + 4.11.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions