-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Blazor] Increment MaxItemCount when OverscanCount > MaxItemCount #63765
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
Conversation
There was a problem hiding this comment.
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 fixes a bug in the Blazor Virtualize
component where OverscanCount > MaxItemCount
caused under-rendering with large blank areas and delayed loading. The fix ensures that the effective MaxItemCount
is elevated to at least match OverscanCount
when needed.
- Updated
CalculateItemDistribution
inVirtualize.cs
to set effectiveMaxItemCount
to at leastOverscanCount
- Added comprehensive E2E test coverage for the large overscan scenario
- Created test components to validate the fix behavior
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Components/Web/src/Virtualization/Virtualize.cs |
Core fix - elevates effective MaxItemCount when OverscanCount exceeds it |
src/Components/test/testassets/BasicTestApp/VirtualizationLargeOverscan.razor |
Test component with OverscanCount=200 and MaxItemCount=5 |
src/Components/test/E2ETest/Tests/VirtualizationTest.cs |
E2E test validating at least 200 items render and remain stable after scroll |
src/Components/test/testassets/BasicTestApp/Index.razor |
Registers new test component for E2E infrastructure |
src/Components/Samples/BlazorUnitedApp/Pages/VirtualizeTest.razor |
Sample page demonstrating virtualization with 500 items |
src/Components/Samples/BlazorUnitedApp/Shared/NavMenu.razor |
Navigation link to new virtualize test page |
global.json |
Updates .NET SDK version from rc.1 to rc.2 |
/backport to release/10.0 |
Started backporting to release/10.0: https://github.com/dotnet/aspnetcore/actions/runs/17915567433 |
@javiercn backporting to "release/10.0" failed, the patch most likely resulted in conflicts: $ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch
Applying: Virtualize test
Using index info to reconstruct a base tree...
M global.json
Falling back to patching base and 3-way merge...
Auto-merging global.json
CONFLICT (content): Merge conflict in global.json
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Virtualize test
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two nits around the test case, otherwise LGTM 👍
src/Components/test/testassets/BasicTestApp/VirtualizationLargeOverscan.razor
Outdated
Show resolved
Hide resolved
96868c7
to
91bf3c6
Compare
/backport to release/10.0 |
Started backporting to release/10.0: https://github.com/dotnet/aspnetcore/actions/runs/17922394462 |
Ensure
Virtualize
renders at leastOverscanCount
items whenOverscanCount > MaxItemCount
Description
Issue #63651 reports incorrect behavior when
OverscanCount
exceedsMaxItemCount
: the component could under‑render (large blank area, late loads) because the effective maximum item window was clamped too low, causing excessive “unused capacity” and spacer translation anomalies.CalculateItemDistribution
) to elevate the effectiveMaxItemCount
to at leastOverscanCount
after applying the (legacy) AppContext override and theMaxItemCount
parameter.VirtualizationLargeOverscan.razor
(inBasicTestApp
) exercisingOverscanCount="200"
withMaxItemCount="5"
.CanElevateEffectiveMaxItemCount_WhenOverscanExceedsMax
in VirtualizationTest.cs verifying:No public API surface changes; only internal logic and test assets updated.
Fixes #63651
Customer Impact
Addresses an issue with the Aspire dashboard.
Without the fix, apps that (intentionally or accidentally) configure a small
MaxItemCount
together with a largeOverscanCount
can observe:After the fix,
Virtualize
behaves predictably: it always renders enough items to satisfy the overscan window while still honoring the safeguard intent ofMaxItemCount
for realistic configurations.Regression?
From 8.x for the aspire case. We don't believe this issue is common outside of the very specific usage Aspire does.
Risk
Justification:
maxItemCount = OverscanCount
when smaller).MaxItemCount >= OverscanCount
, behavior unchanged).Verification
Packaging changes reviewed?