microsoft / fluentui-blazor

Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications
https://www.fluentui-blazor.net
MIT License
3.83k stars 372 forks source link

fix: FluentTreeView selection bug #3 #2911

Open markoweb2 opened 3 days ago

markoweb2 commented 3 days ago

πŸ› Bug Report

Just tested the new 4.10.3 build, the supposed fixes for FluentTreeView have made it even worse than before :(

πŸ’» Repro or Code Sample

<FluentTreeView Items="@list" @bind-SelectedItem="this.selectedItem">
    <ItemTemplate>
        @context.Text
    </ItemTemplate>
</FluentTreeView>

@code
{
    private ITreeViewItem? selectedItem;
    private List<TreeViewItem> list = new List<TreeViewItem>() { new TreeViewItem() { Expanded = true, Text = "test 1", Items = new List<TreeViewItem>() { new TreeViewItem() { Text = "sub test 2" } } }, 
        new TreeViewItem() { Text = "test 2" } };
}

πŸ€” Expected Behavior

The control should work and items should be selectable.

😯 Current Behavior

Nothing is selectable in the FluentTreeView:

Image

πŸ”¦ Context

This is a regression from 4.10.2, the above code at least worked and everything was selectable.

The original issues were #2797 and #2798 . If you remove the <ItemTemplate>, then "test 2" and "sub test 2" become selectable, but not "test 1".

Also, if you just use minimalist code:

<FluentTreeView Items="@list"></FluentTreeView>

@code
{
    private List<TreeViewItem> list = new List<TreeViewItem>() { new TreeViewItem() { Text = "test 1" }, new TreeViewItem() { Text = "test 2" } };
}

Then you now end up with an endless flicker loop (also worse than before): Image

🌍 Your Environment

OS = Windows Browser = Microsoft Edge, Google Chrome .NET and Fluent UI Blazor library Version = 8.0.10 and 4.10.3 Visual Studio 2022 (17.11.5)

vnbaaij commented 2 days ago

Is this on Wasm or Server?

Also, please confirm it is not a cached .lib.js file issue (hard refresh / clear cache)

markoweb2 commented 2 days ago

This is on server with InteractiveServerRenderMode(false)

Did a clean solution, rebuild solution, CTRL+F5 in browser, doesn't seem to be a cache issue.

vnbaaij commented 2 days ago

Ok, will try to take a look later today. Currently on airport wifi without PC.