Expose experimental AnchorMode and ItemComparer on QuickGrid - #67783
Merged
Conversation
ilonatommy
force-pushed
the
quickgrid-virtualize-intrinsic-tests
branch
from
July 14, 2026 17:25
9b5a462 to
9904dd0
Compare
Poll the initial "starts at top" scrollTop check via AssertScrollTop instead of asserting a single instant right after mount, and treat a blank viewport (no item intersecting) as an unsettled transient state in WaitForRenderToSettle so it waits for the anchor restore to complete before the test reads the viewport. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Open
3 tasks
6 tasks
This reverts commit eddf590.
ilonatommy
force-pushed
the
quickgrid-virtualize-intrinsic-tests
branch
from
July 17, 2026 07:13
0710611 to
09ec126
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR exposes QuickGrid’s virtualization anchoring controls by adding two experimental parameters—AnchorMode and ItemComparer—and forwarding them to the internal Virtualize usage, enabling stable viewport behavior when items are prepended/appended during virtualized data loads.
Changes:
- Add experimental
AnchorMode(VirtualizeAnchorMode) andItemComparer(IEqualityComparer<TGridItem>?) parameters toQuickGrid<TGridItem>. - Forward these parameters to the underlying
Virtualizeinstance via an attribute-splat dictionary. - Add a new BasicTestApp test component plus expanded E2E coverage for QuickGrid anchoring behaviors; document new analyzer diagnostic
ASP0030.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Components/test/testassets/BasicTestApp/QuickGridTest/QuickGridAnchorModeComponent.razor | New test component exercising QuickGrid anchoring modes with Items and ItemsProvider. |
| src/Components/test/testassets/BasicTestApp/Index.razor | Adds navigation entry for the new anchoring test component. |
| src/Components/test/testassets/BasicTestApp/BasicTestApp.csproj | Suppresses ASP0030 for the test asset that intentionally uses experimental APIs. |
| src/Components/test/E2ETest/Tests/VirtualizationTest.cs | Adds E2E tests validating QuickGrid anchoring/viewport stability across modes and mutations. |
| src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor.cs | Introduces AnchorMode/ItemComparer parameters and builds Virtualize attribute-splat values. |
| src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/QuickGrid.razor | Applies the new Virtualize attributes via @attributes. |
| src/Components/QuickGrid/Microsoft.AspNetCore.Components.QuickGrid/src/PublicAPI.Unshipped.txt | Declares new public API surface for the added parameters. |
| docs/list-of-diagnostics.md | Updates analyzer diagnostic range and adds ASP0030 description. |
…th the delay, the non-delayed version will work as well. No need to duplicate.
dariatiurina
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds two experimental parameters to
QuickGrid<TGridItem>that let virtualized grids control viewport anchoring when data changes at the edges of the list:AnchorMode(VirtualizeAnchorMode, defaultStart) - controls how the viewport behaves when new items arrive during virtualization (mirrors the existingVirtualize.AnchorMode).ItemComparer(IEqualityComparer<TGridItem>?) - useful for reference types, lets the grid detect whether items were prepended or appended between data loads. Without it, anchoring across data changes might not work properly.Both are marked
[Experimental("ASP0030")], so consumers must explicitly opt in.Virtualizealready supports edge anchoring viaAnchorMode/ItemComparer, butQuickGrid(which wrapsVirtualizeinternally) only exposed the defaultStartbehavior and provided no way to enable anchoring forItemsProvider-backed grids. This closes that gap for scenarios like chat/log tails and infinite-scroll grids.API surface
Usage example
Test coverage summary
where 🆕 is a added by this PR, ❌ is failing currently. Tests on 5 runs, result is failures/total:
None_AsyncProvider[Fact])Behavioral changes in comparison to net10 - no regression of the default `Start` mode without `ItemComparer`