Fix QuickGrid Start-mode async-provider prepend viewport drift. - #67935
Merged
ilonatommy merged 1 commit intoJul 21, 2026
Merged
Conversation
ilonatommy
temporarily deployed
to
copilot-pat-pool
July 21, 2026 11:55 — with
GitHub Actions
Inactive
ilonatommy
temporarily deployed
to
copilot-pat-pool
July 21, 2026 11:55 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Pull request overview
Extends the prior QuickGrid/Virtalize async-provider prepend anchoring fix (previously scoped to AnchorMode.None) to also cover AnchorMode.Start when the viewport is not at the very top, preventing viewport “drift” during the async anchor-restore round-trip (notably on Blazor Server).
Changes:
Virtualize.cs: defers clearing_pendingAnchorRestoreacrossRestoreAnchorAsyncfor Start-mode prepends that began away from the top (via_deferPrependAnchorClear).Virtualize.ts: avoids overwriting a stable anchor snapshot with a transient “loading gap” snapshot for Start mode when not converging to top.VirtualizationTest.cs: re-enables previously-disabled Start-mode async-provider E2E permutations now covered by the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Components/Web/src/Virtualization/Virtualize.cs | Holds anchor-restore suppression across the async restore for Start-mode prepends away from top, preventing premature spacer callbacks from undoing the shift. |
| src/Components/Web.JS/src/Virtualize.ts | Skips transient mid-load anchor snapshots for Start mode (when not converging), matching the earlier None-mode behavior. |
| src/Components/test/E2ETest/Tests/VirtualizationTest.cs | Re-enables Start-mode async-provider test cases that were disabled due to the previously observed drift. |
dariatiurina
approved these changes
Jul 21, 2026
This was referenced Jul 21, 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.
Follow-up to #67931 (which fixed the same problem in AnchorMode.None ). Extends the fix to
AnchorMode.Startwhen items are prepended toQuickGridwith asyncItemsProvider. Contributes to #67865.The problem
QuickGridrenders as a<table>, and browser-native scroll anchoring is unreliable inside table layout, soVirtualizefalls back to manual JS scroll compensation. On Blazor Server, restoring that anchor is an async round-trip. During the latency after a prepend, two things went wrong in Start mode:WASM was unaffected because the restore there is synchronous.
The fix
Extend the anchor-restore deferral (already used for
None) toStartmode (but only when the prepend did not happen at the very top):• Virtualize.cs : keep
_pendingAnchorRestoreset across theRestoreAnchorAsyncround-trip for a Start-mode prepend that started away from the top, so the premature callback can't revert it. A new flag (_deferPrependAnchorClear) carries the "was at top?" signal from prepend time to render time, where it's otherwise no longer available.• Virtualize.ts : skip the transient loading-gap anchor snapshot for
Starttoo, guarded by!convergingToTop.Why "not at top" matters: at the very top,
Startmode must converge back to the new first item (show the freshly prepended rows), so that path is deliberately left untouched. Only once the viewport has left the top does Start need to anchor the current row (which is where the drift occurred).New QuickGrid AnchorMode test coverage summary, updated after #67931
None_AsyncProvider[Fact])