Skip to content

fix: Loading == true ignored when Items == null in DataGrid #2734

@cdock1029

Description

@cdock1029

🐛 Bug Report

items == null overrides loading == true, such that No data to show! is displayed instead of Loading..
prior to the IEnumerable having data.

💻 Repro or Code Sample

@rendermode @(new InteractiveAutoRenderMode(prerender: true))

				
		<FluentDataGrid Items="MyData?.AsQueryable()" Loading="@(MyData is null)">
			...
		</FluentDataGrid>
	

@code {

	[Parameter] public IEnumerable<MyEntity>? MyData { get; set; }
}

🤔 Expected Behavior

Collections are either null, empty, or full. I would expect the most common state where loading should display is when the data is null, during data loading. If it comes back empty that is when "No data" takes effect. Or in any case, Loading == true should display loading regardless of anything else.

😯 Current Behavior

When Items is empty, Loading == true takes effect and displays properly.

<FluentDataGrid Items="(RecentTreasuries ?? []).AsQueryable()" Loading="@(MyData is null)">
    ...
</FluentDataGrid>

💁 Possible Solution

Give precedence to Loading == true

🔦 Context

Just unexpected, and I guess I could throw that empty list in there but seems better the other way, just using the null parameter as is.

🌍 Your Environment

  • OS & Device: Windows 11
  • Browser Microsoft Edge
  • .NET 9 Preview, Fluent UI Blazor 4.10.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions