Expose experimental AnchorMode and ItemComparer on QuickGrid#67783
Draft
ilonatommy wants to merge 2 commits into
Draft
Expose experimental AnchorMode and ItemComparer on QuickGrid#67783ilonatommy wants to merge 2 commits into
AnchorMode and ItemComparer on QuickGrid#67783ilonatommy wants to merge 2 commits into
Conversation
9b5a462 to
9904dd0
Compare
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.Virtualize changes
Pure
Virtualizedoes a single render after the mutation (no extraStateHasChangedthat is inQuickGridand itsRefreshDataAyncdeliberately avoids re-rendering). That extra render/observer-refresh pass is what generated additional spacer callbacks in the narrow window between render and restore. That's why the issue started manifesting only inQuickGridtests, not in pureVirtualize.A stale
IntersectionObserverspacer callback landing between the shifted render and the anchor restore clobbered the JS anchor snapshot (dropping the scrollTop compensation) and recomputed the .NET window from pre-shift geometry,causing QuickGrid prepend viewport jumps under an async ItemsProvider.
Fixed:
_pendingAnchorRestoreonly afterRestoreAnchorAsyncround-trips so in-flight stale spacer callbacks are ignored.