Skip to content

Improve QuickGrid virtualization coverage - #67671

Merged
ilonatommy merged 8 commits into
mainfrom
quickgrid-virtualize-intrinsic-tests
Jul 10, 2026
Merged

ilonatommy merged 8 commits into
mainfrom
quickgrid-virtualize-intrinsic-tests

Conversation

@ilonatommy

@ilonatommy ilonatommy commented Jul 8, 2026 •

Copy link
Copy Markdown
Member

QuickGrid uses Virtualize<TItem> internally, but our E2E suite exercises almost all of those behaviors only against the raw Virtualize component. Only two tests today run virtualization through a grid. One notable gap is capacity/robustness under a misconfigured ItemSize - a very common real-world mistake, since QuickGrid forwards ItemSize but can't know the true rendered row height.

The an async ItemsProvider combined with a under-estimated ItemSize, when scrolling fast exposing the bottom spacer, is prone to callback cancellation. We have to make sure the items are eventually loaded and the viewport is not left blank.

The symmetric raw-Virtualize test is

public async Task ToleratesIncorrectItemSize()

The variable-height version of the test was failing because wrong placeholder size was used. We are passing PlaceholderContext to RenderPlaceholderRow for some reason we were not setting it in QuickGrid, like we do for Virtualize:

builder.AddAttribute(1, "data-blazor-virtualize-reserved-height", GetSpacerHeightPx(_itemsBefore));

So the JS code that was reading it in

['data-blazor-virtualize-reserved-height', 'height', (n: number) => `${n}px`],
got no value and the row collapsed to its natural height, based purely on what's inside it. For cells holding "..." placeholder it's ~21px. The explicitly set height, coming from current item size estimate is ~78px.

Situation before the variable height fix:

QuickGrid-vairaible-height.mp4

After this PR:

variable-height-working.mp4

@ilonatommy ilonatommy self-assigned this Jul 8, 2026
Copilot AI review requested due to automatic review settings July 8, 2026 12:10
@ilonatommy
ilonatommy requested a review from a team as a code owner July 8, 2026 12:10
@ilonatommy ilonatommy added area-blazor Includes: Blazor, Razor Components feature-blazor-virtualization This issue is related to the Blazor Virtualize component labels Jul 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands Blazor QuickGrid virtualization E2E coverage by adding a new scenario that exercises fast scrolling with an asynchronous ItemsProvider and an under-estimated ItemSize, helping ensure QuickGrid doesn’t get stuck rendering placeholders under cancellation/starvation conditions.

Changes:

  • Add a new BasicTestApp QuickGrid test component that virtualizes rows with intentionally incorrect ItemSize plus async provider latency.
  • Register the new test component in the BasicTestApp component picker.
  • Add a new E2E test that fast-scrolls the QuickGrid container and asserts the viewport eventually renders real (non-placeholder) data.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/Components/test/testassets/BasicTestApp/QuickGridTest/QuickGridVirtualizeCapacityComponent.razor New test component to reproduce fast-scroll + async provider + incorrect ItemSize conditions for QuickGrid virtualization.
src/Components/test/testassets/BasicTestApp/Index.razor Adds a navigation entry for the new QuickGrid virtualization capacity test page.
src/Components/test/E2ETest/Tests/VirtualizationTest.cs Adds an E2E test that fast-scrolls a virtualized QuickGrid and validates the viewport recovers from placeholder-only rendering.

@ilonatommy
ilonatommy marked this pull request as draft July 8, 2026 12:34
@ilonatommy
ilonatommy enabled auto-merge (squash) July 10, 2026 12:18
@ilonatommy
ilonatommy requested a review from dariatiurina July 10, 2026 12:18
@ilonatommy
ilonatommy merged commit de9f8e0 into main Jul 10, 2026
25 checks passed
@ilonatommy
ilonatommy deleted the quickgrid-virtualize-intrinsic-tests branch July 10, 2026 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-blazor Includes: Blazor, Razor Components feature-blazor-quickgrid feature-blazor-virtualization This issue is related to the Blazor Virtualize component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants