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.23k stars 294 forks source link

fix: Clicking content in the DataGrid's empty content throws an exception #2000

Closed joriverm closed 2 weeks ago

joriverm commented 2 weeks ago

šŸ› Bug Report

when adding an interactive component inside the empty row content, and clicking it webcomponents will throw an error saying it can't find the row because the empty row does not contain an id.

šŸ’» Repro or Code Sample

in the example code i replaced the Intermittent loading example of the datagrid to have a button in its content when empty :

<div style="height: 400px; overflow-y: scroll;">
    <FluentDataGrid @ref="grid" Items=@items GridTemplateColumns="1fr 1fr 1fr 1fr" Style="height: 100%;">
        <ChildContent>
            <PropertyColumn Property="@(c => c.Item1)" Sortable="true" />
            <PropertyColumn Property="@(c => c.Item2)" />
            <PropertyColumn Property="@(c => c.Item3)" Align="Align.Center" />
            <PropertyColumn Property="@(c => c.Item4)" Align="Align.End" />
        </ChildContent>
        <EmptyContent>
            <FluentButton IconStart="@(new Icons.Filled.Size24.Crown())">&nbsp; Nothing to see here. Carry on!</FluentButton>
        </EmptyContent>
    </FluentDataGrid>
</div>

šŸ¤” Expected Behavior

nothing to happen besides the button click

šŸ˜Æ Current Behavior

the click event happens, but webcomponents throws an error : image

šŸ’ Possible Solution

giving the empty-content-row an id prevents the webcomponents from throwing an exception. PR is incoming

šŸ”¦ Context

the issue has no effect on our code, but it shouldn't throw an error imo. this just fixes it so we don't think anything is wrong in our client code :)

šŸŒ Your Environment