MudBlazor / MudBlazor

Blazor Component Library based on Material design with an emphasis on ease of use. Mainly written in C# with Javascript kept to a bare minimum it empowers .NET developers to easily debug it if needed.
http://mudblazor.com
MIT License
8.16k stars 1.29k forks source link

.net9 Virtualize has a new property MaxItemCount, breaks MudVirtualize for larger OverscanCount values #10290

Open malcolmbdev opened 1 day ago

malcolmbdev commented 1 day ago

Things to check

Bug type

Component

Component name

MudVirtualize

What happened?

.net9 seems to have introduced a new property Virtualize.MaxItemCount which defaults to 100.

When using e.g. a MudDataGrid with virtualized server data, the GridStateVirtualize.Count is never more than 100 regardless of the calculated Count based on the OverscanCount.

The MudDataGrid/MudVirtualize uses its calculated Count to ask for more data so if you have a OverscanCount of 50 you might expect the Count to perhaps be 110 but the returned rows are only 100 so after scrolling to the 100th row and keep scrolling you get blank lines until the 110th row is scrolled to and then the data refreshes.

I had a play and hardcoded a big MaxItemCount in the MudVirtualize code and it then gives the expected behaviour, not sure if you want a MaxItemCount on MudVirtualize with a big default value? Not sure why the MaxItemCount on .net9 Virtualize has been added though.

Expected behavior

.net9 works like .net8 and respects larger OverscanCount values.

Reproduction link

https://try.mudblazor.com/snippet/mEGSbFcOUPMnRyBl

Reproduction steps

The try.mudblazor snippet above will just be .net8, if there isn't a .net9 try.mudblazor then it works fine with the tmb repo code or any other project and shows the problem.

Relevant log output

No response

Version (bug)

7.15

Version (working)

No response

What browsers are you seeing the problem on?

Firefox, Chrome

On which operating systems are you experiencing the issue?

Windows

Pull Request

Code of Conduct

ScarletKuro commented 1 day ago

A PR adding MaxItemCount to MudVirtualize and adding them to table / datagrid to proxy them are welcome.