Skip to content

fix: FluentDataGrid starts to flicker on large datasets #3684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
StefanJansson opened this issue Apr 15, 2025 · 12 comments
Open

fix: FluentDataGrid starts to flicker on large datasets #3684

StefanJansson opened this issue Apr 15, 2025 · 12 comments
Labels
area:blazor A blazor-specific issue status:blocked Any issue blocked by another

Comments

@StefanJansson
Copy link
Contributor

StefanJansson commented Apr 15, 2025

🐛 Bug Report

With larger rowcounts in dataset, the FluentDataGrid ui starts a rerendering loop or something, the grid is flickering forever.

💻 Repro or Code Sample

I've provided a sample code and on my machine this behavior occurs between 430k and 440k rows.

🤔 Expected Behavior

Datagrid should be able to handle larger datasets.

😯 Current Behavior

On my pc, FluentDataGrid shows this behavior above 430k rows

💁 Possible Solution

🔦 Context

FluentDataGrid cannot be used on larger datasets.

FluentDataGridIssue.zip

🌍 Your Environment

Win11, Edge and VS2022. Everything updated to the latest

@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New issue. Needs to be looked at label Apr 15, 2025
@StefanJansson StefanJansson changed the title fix: FluentDataGrid starts to flicker on large rowcount and visualize fix: FluentDataGrid starts to flicker on large datasets Apr 15, 2025
@StefanJansson
Copy link
Contributor Author

StefanJansson commented Apr 16, 2025

Here's an output on the console that shows some behavior on requesting same data multiple times when I hit 440k row count.

Image

@vnbaaij
Copy link
Collaborator

vnbaaij commented Apr 16, 2025

For me, with your code, it just stops rendering the grid at a certain point:

Image

I've copied the code to a new standard Blazor project and tried it with the standard QuickGrid and I'm seeing the same behaviour there:

Image

It happens only at a later point in going through the data. But as it is also happening there, I'm suspecting the Virtualize component to be the cause of this.

I think it would be best to open an issue in the aspnetcore repo for this

@vnbaaij vnbaaij added area:blazor A blazor-specific issue status:blocked Any issue blocked by another and removed triage New issue. Needs to be looked at labels Apr 16, 2025
@StefanJansson
Copy link
Contributor Author

StefanJansson commented Apr 16, 2025

If I in my environment starts with 440k entries and try to scroll down by clicking the arrow, the behavior is showing.

So you think the problem isn't within Microsoft.FluentUI.AspNetCore.Components but AspNetCore instead? If so, will you escalate it?

@vnbaaij
Copy link
Collaborator

vnbaaij commented Apr 16, 2025

Yes, it think it is in AspNetCore itself.

If you add a new standard Blazor Web App (Server/per page) project to the solution you shared and add the below code to the homepage, you should be able to observe the same issue (although most probably at a different location in the scrolling process).

@page "/"
@using Microsoft.AspNetCore.Components.QuickGrid
@rendermode @(new InteractiveServerRenderMode(false))

<PageTitle>Home</PageTitle>

<h1>Working QuickGrid</h1>

<InputNumber @bind-Value="@RowCount" @bind-Value:after="RefreshGrid"  />
<div style="height: 400px; max-width: 800px; overflow-y: scroll;">
    <QuickGrid @ref="grid" ItemsProvider="SampleProvider" Virtualize="true" ItemSize="32" TGridItem="SampleGridData">
        <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>
    </QuickGrid>
</div>

@code {
    QuickGrid<SampleGridData>? grid;
    public record SampleGridData(string Item1, string Item2, string Item3, string Item4);
    private int RowCount = 430_000;

    private ValueTask<GridItemsProviderResult<SampleGridData>> SampleProvider(GridItemsProviderRequest<SampleGridData> request)
    {
        Console.WriteLine($"RowCount: {RowCount}, request.StartIndex: {request.StartIndex}, request.Count: {request.Count}");

        var data = new List<SampleGridData>();

        if (request.Count != null)
        {
            for (var i = request.StartIndex; i < request.StartIndex + request.Count; i++)
            {
                data.Add(new SampleGridData($"value {i}-1", $"value {i}-2", $"value {i}-3", $"value {i}-4"));
            }
        }

        var result = GridItemsProviderResult.From<SampleGridData>(
            items: data, // Lägg till ToList()
            totalItemCount: RowCount);
        Console.WriteLine($"request complete: {data.Count} rows");

        return new ValueTask<GridItemsProviderResult<SampleGridData>>(result);
    }

    private async Task RefreshGrid()
    {
        await grid!.RefreshDataAsync();
    }

}

@vnbaaij
Copy link
Collaborator

vnbaaij commented Apr 16, 2025

If so, will you escalate it?

Let's first see if you can recreate the issue with standard Blazor as well. If so, we can determine next steps

@StefanJansson
Copy link
Contributor Author

I haven't been able to reproduce it with quickgrid, even though I started with 1M rows

@vnbaaij
Copy link
Collaborator

vnbaaij commented Apr 16, 2025

That is weird. You can clearly see it going off the rails in the screenshot I posted. Are you sing the same code I posted? Or something different?

Have you tried just moving the scroll bar almost all the way down to the end in a quick motion?

@StefanJansson
Copy link
Contributor Author

StefanJansson commented Apr 17, 2025

Yes, scrolling with the arrow buttons, mouse wheel and dragging and clicking the scroll bar creates no problem. But, if I drag the scrollbar to the end, it fails.

@vnbaaij
Copy link
Collaborator

vnbaaij commented Apr 17, 2025

With the standard Blazor code? If yes, that shows it is a Blazor /Virtualize issue, I believe.

@StefanJansson
Copy link
Contributor Author

Strange, now I managed to force the errors without any problems. I agree that the issue is not withing this package

Recording.2025-04-17.080519.mp4

@StefanJansson
Copy link
Contributor Author

How do we continue, should I create an issue for this?

@vnbaaij
Copy link
Collaborator

vnbaaij commented Apr 22, 2025

We've established it is an ASP. NET Core /quickgrid issue as well. I would recommend to create an issue there (with the reproduction code we used). At this moment I do not think there is anything we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:blazor A blazor-specific issue status:blocked Any issue blocked by another
Projects
None yet
Development

No branches or pull requests

2 participants