Blazorise icon indicating copy to clipboard operation
Blazorise copied to clipboard

[Bug]: Virtualize isn't virtualizing...

Open tesar-tech opened this issue 1 year ago • 6 comments

Blazorise Version

1.6.2

What Blazorise provider are you running on?

Bootstrap5

Link to minimal reproduction or a simple code snippet

I was exploring the https://github.com/Megabit/Blazorise/issues/5793 and discovered weird issue with ListView and Virtualize flag.

Simple ListView

@using Blazorise.Components
@using Blazorise

<ListView TItem="int"
          Data="list"
          TextField="item => item.ToString()"
          ValueField="item => item.ToString()"
          Virtualize/>

<Button Color="Color.Primary" Clicked="() => {}" >a Button</Button>

@code {
    List<int> list = Enumerable.Range(0, 1000).ToList();
}

Steps to reproduce

The Virtualized list is displayed correctly, even works correctly. But once you "force" it to do some re-render (for example by clicking a button) it spits out all the <li> into the dom...

https://github.com/user-attachments/assets/bb6b4170-cadf-4573-817b-b0663dea01c4

.net8, wasm only.

I will share a bug repo once you confirm it's something we should care about. Not sure about Blazor Server and other components where virtualization is a thing.

My guess is that it is somehow related to the RenderFragment which is inside the virtualize component... because it doesn't have the key (the key is rather inside the fragment).

What is expected?

Virtualize shouldn't have all the elements at once (unless small list)...

What is actually happening?

Simple button click forces the Virtualize to add all the elements to the dom.

What browsers do you see the problem on?

Microsoft Edge

Any additional comments?

No response

Edit:

Observations:

  • doesn't happen on server interactivity
  • doesn't happen on DataGrid

tesar-tech avatar Nov 06 '24 21:11 tesar-tech

We can look into this after 1.7 release. And fix it as part of the maintenance update.

stsrki avatar Nov 07 '24 09:11 stsrki

We can look into this after 1.7 release. And fix it as part of the maintenance update.

Should we not make an effort to fix this now known bug in 1.6 and merge to master and have it right away on 1.7?

David-Moreira avatar Nov 07 '24 23:11 David-Moreira

We don't have much time for 1.6 now, so we need to focus on releasing 1.7 next week.

stsrki avatar Nov 08 '24 08:11 stsrki

It's not only a 1.6 concern. But 1.7 also. You are knowingly releasing a hug in a stable version. And it's a bug in a somewhat "basic" feature.

David-Moreira avatar Nov 08 '24 08:11 David-Moreira

We need to prioritize the issues for our upcoming release to ensure that we are focusing our efforts effectively. While we’ve come across the current issue, it’s important to note that it was discovered accidentally and is not as critical as some of the other concerns we’re addressing.

So I would like us to concentrate on the more pressing issues first, which will have a greater impact on our release.

stsrki avatar Nov 08 '24 09:11 stsrki

This one is interesting...

  • Applies only to users without a Blazorise license key.
  • Occurs only in WASM.
  • Root cause: Likely a bug in WASM.
  • Detailed issue:
    • The problem starts at this line inside ListView.
    • The way WASM handles the Take method causes it to "strip down" the ICollection "identity" (the suspected bug), which makes it incompatible with the Virtualize component.

Not critical:
Non-licensed users are capped at displaying 1000 lines, which is effectively handled by witnout the Virtualize component.

Next steps:
I suggest waiting for a response from the .NET runtime team before taking further action. While workarounds exist, they are not particularly elegant...

tesar-tech avatar Jan 10 '25 20:01 tesar-tech