You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make hook-based paging the only DataGrid paging path - #1832
↑ All 50 CI checks pass on this head, coverage up (line +0.11 pp, branch +0.18 pp). ↑ Full Reactor.Tests suite (16,960) and all DataGrid and async-resource selftests pass locally. ↑ Every regression test added during review was mutation-checked: it fails with its fix reverted. ↑ Local /perf DataGrid leg within noise vs main (measured before the later review rounds). ↓ Shared UseInfiniteResource behavior changed for every caller, not only the grid.
Summary
The DataGrid now pages only through UseDataSource / UseInfiniteResource, and the old DataPageCache path is gone, along with ReactorFeatureFlags.UseHookBasedPaging. The hook path needed a few things the old default did before it could take over:
Client-side sort and filter for sources without ServerSort / ServerFilter. A new internal DataGridPagingSource<T> loads the rows in one request (still capped by MaxClientFallbackPageSize), sorts or filters them, and hands the whole result back as the first page, so every row is loaded at once like before.
Refetch on every query change. Pages used to come back from the QueryCache when you returned to an earlier sort, even after the data changed. The grid now drops its cached pages when the request changes and on unmount.
At most 20 pages kept, like the old block cache, rendered or headless. InfiniteResource.Items is now a view over the loaded pages instead of a TotalCount-sized array rebuilt on every page change. Evicted pages release their cache entry, in-flight pages don't count toward the cap, and the rows in view stay loaded when pages a fast scroll asked for land late.
Rows arriving after a scroll weren't refreshed once any earlier state change had rendered (the realized-row refresh treated the hook's render as older than the scroll). The grid now stamps those renders or leaves them to the settle timer.
A failed first page shows the error template instead of a page of placeholders, also after a refresh, and a page the source cancels on its own (an HTTP timeout, say) fails instead of staying in flight forever.
InfiniteResource.Refresh() keeps the known total while page 0 reloads, as it was documented to, so an observable source's DataChanged no longer resets the scroll position.
Headless DataGridState.LoadDataAsync keeps working. It drives the same hook state through a small core-internal DetachedDataSourceResource<T> (no QueryCache), completes when the first page is in, and throws if it fails.
Linked issue / spec
Relates to #1819. Finishes spec 020 §11.3 (docs/specs/020-async-resources-design.md).
Test plan
dotnet test tests/Reactor.Tests: 16,960 passed. tests/Reactor.DocPipeline.Tests: 593 passed
New unit tests: DataGridPagingSourceTests (fallback, headless loads, cancellation, superseded loads, value-type rows, page cap), plus InfiniteResourceTests and UseInfiniteResourceTests cases for the view, eviction, refresh and source-side cancellation
dotnet run --project tests/Reactor.AppTests.Host -- --self-test --filter "DataGrid": 0 failures, including new DataGridParityFixtures for client sort/filter on screen, refetch on returning to a sort, rows landing after a scroll, observable sources (incl. worker thread and keeping the scroll position), search, the page cap, late pages, failed pages and failed refreshes
--filter "Async" selftests: 0 failures
dotnet build Reactor.slnx --no-restore -c Release: clean except the VS extension projects, which couldn't restore from nuget.org on my machine. CI's Build solution passes.
Local /perf DataGrid leg vs main: all metrics within noise
Regenerated both reactor.api.txt copies, the reference docs and the edited guide pages
Risk / breaking changes
Removed public API: DataPageCache<T>, CacheBlock<T>, BlockStatus, ReactorFeatureFlags.UseHookBasedPaging, DataGridState<T>.PageCache and RowKeyCache. DataGridState<T>.HookResource is renamed RowsResource and SetHookResource is now internal. The CHANGELOG has a member-by-member migration.
Behavior to know about: in client-side sort/filter mode TotalCount is the number of rows shown, and shift-click now selects a range whenever every row is loaded (it used to only in that mode). The UseInfiniteResource changes (items view, eviction, cancellation, refresh) apply to every user of the hook, not just the grid.
Port the client-side sort/filter fallback to the UseDataSource path, drive
headless DataGridState.LoadDataAsync through the same InfiniteResource
machinery, and remove DataPageCache, CacheBlock, BlockStatus,
ReactorFeatureFlags.UseHookBasedPaging, DataGridState.PageCache and
RowKeyCache (spec 020 section 11.3, #1819).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- InfiniteResource.Items is a view over loaded pages instead of a
TotalCount-sized array per page change; evicted pages release their
cache entry; a failed page no longer extends the view.
- A page the source cancels on its own fails instead of staying in flight.
- InfiniteHookState serializes its bookkeeping for headless loads.
- DataGrid keeps 20 pages like the old block cache, drops its cached pages
on unmount, and reloads observable changes on the UI thread.
- LoadDataAsync faults on a failed first page and completes when replaced;
HookResource is renamed RowsResource and SetHookResource is internal.
- Row occupancy works for value-type rows.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Artifact sizes for 50eb5fd vs the base branch (7020f0c).
Packages (compressed .nupkg)
Artifact
base
PR
Δ
Microsoft.UI.Reactor.nupkg
2.19 MB
2.19 MB
-1003 B (-0.04%)
≈
Microsoft.UI.Reactor.Advanced.nupkg
531.4 KB
535.0 KB
+3.65 KB (+0.69%)
⚠️
Microsoft.UI.Reactor.Devtools.nupkg
290.6 KB
290.6 KB
-17 B (-0.01%)
≈
Assemblies in Microsoft.UI.Reactor
Artifact
base
PR
Δ
Microsoft.UI.Reactor.dll
2.93 MB
2.92 MB
-512 B (-0.02%)
≈
Reactor.Analyzers.dll
469.5 KB
469.5 KB
+0 B (0.00%)
≈
Reactor.Localization.Generator.dll
16.0 KB
16.0 KB
+0 B (0.00%)
≈
Reactor.Wrappers.Abstractions.dll
12.0 KB
12.0 KB
+0 B (0.00%)
≈
Reactor.Wrappers.Generator.dll
229.5 KB
229.5 KB
+0 B (0.00%)
≈
Assemblies in Microsoft.UI.Reactor.Advanced
Artifact
base
PR
Δ
Microsoft.UI.Reactor.Advanced.dll
1.08 MB
1.09 MB
+8.00 KB (+0.72%)
⚠️
Assemblies in Microsoft.UI.Reactor.Devtools
Artifact
base
PR
Δ
Microsoft.UI.Reactor.Devtools.dll
791.5 KB
791.5 KB
+0 B (0.00%)
≈
✅ smaller / ⚠️ larger / ≈ within noise. Sizes come from a Release dotnet pack on the CI runner: packages are the compressed .nupkg download size, assemblies the uncompressed DLL inside it. workflow run.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved paging defects cause excessive data retention, stale results after refresh, incorrect LRU eviction, and inconsistent values for overlapping pages.
Coverage for 50eb5fd vs the base branch (7020f0c) — unit + selftest merged.
Metric
base
PR
Δ
Line
89.22%
89.33%
+0.11 pp
✅
Branch
43.99% (18780/42687)
44.17% (18881/42749)
+0.18 pp
✅
✅ higher / ⚠️ lower / ≈ within noise. Δ is in percentage points; coverage is unit + selftest merged (Debug x64) on the CI runner. Cobertura reports attached to the workflow run as artifacts.
- Release the client-side result when paging from the source again.
- Keep rows in view recent for MaxLoadedPages, without refetching rows an
oversized fallback page already holds.
- LoadedRows takes the indexer's value where pages overlap.
- Cap headless DataGridState loads at the grid's 20 pages.
- Refresh invalidates every page of the query, evicted ones included.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ItemAt returns placeholders when overlapping pages contain the row
src/Reactor/Core/InfiniteResource.cs:165
This covering-page lookup is bypassed when an overlapping page already has an in-flight slot. For example, request pages 0 and 1 with PageSize 10, then let page 0 return 25 rows while page 1 remains pending: Items[15] contains row 15, but ItemAt(15) returns default from the earlier slot branch. Consumers using ItemAt therefore show placeholders for loaded data. Apply the covering-page fallback to existing slots that cannot supply the requested row, matching ItemsView.
In-flight pages incorrectly count toward the loaded-page cap
src/Reactor/Core/InfiniteResource.cs:493
The eviction loop counts in-flight slots toward MaxLoadedPages: with 21 requests outstanding and a cap of 20, the first completed page is immediately evicted even though it is the only loaded page. Rapid scrolling against a slow source can therefore discard arriving rows and trigger redundant fetches. Count only completed pages toward the cap, and add a regression test with overlapping asynchronous requests.
- EnsureRange only treats rows as covered by an oversized page within the
requested range, so rows past it are still requested without a total.
- ItemAt reads a row an oversized page holds when its own page is in flight.
- Only loaded pages count toward MaxLoadedPages.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Asynchronous data refreshes lose the known row count and replace the virtual list with a loading template, destroying its scroll state and returning users to the top.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Preserve virtual list scroll position when refreshing observable data
When an asynchronous observable source raises DataChanged after scrolling, Refresh() replaces the resource without retaining TotalCount; the pending render then reports zero rows and replaces the VirtualList with the loading template. This destroys its ScrollViewer, so the grid returns at the top when page 0 arrives. Preserve the known extent and viewport across refresh, reload the visible pages, and add a regression test with a delayed observable source.
InfiniteResource.Refresh keeps the known TotalCount while page 0 reloads,
as documented, and the grid reloads the rows in view, so an observable
source's DataChanged no longer resets the scroll position.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A failed refresh after a successful load can hide the error behind placeholders because the retained total count remains nonzero, requiring a corrected error-template condition and regression coverage.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because refreshes can retain misleading totals that hide rows or leave stale placeholders, while failed pages can accumulate LRU metadata despite cache limits.
Follow-up from Copilot's round 8 summary: an evicted page releases its
cache entry, so its next cursor is kept separately and a cursor-paged
source doesn't refetch the chain to revisit a page.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Eviction cursor history grows without bound for DataGrid/UseDataSource requests despite the 20-page cap, even though CursorFromPageIndex makes that history unnecessary.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because late offscreen page completions can evict the visible page after scrolling stops, leaving placeholders visible until another scroll.
Follow-up from Copilot's round 10 summary: each page that lands outside a
scroll marks the rows in view as recently used again (and reloads any a
late page evicted).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
A persistent page failure can trigger an unbounded request/render loop without further scrolling; the queued load needs an error-state guard and regression coverage.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The changes span shared paging lifecycle, cancellation, eviction, and WinUI refresh behavior, but independent cross-model review and Windows runtime validation were unavailable.
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
ready-for-reviewAgent work and technical checks complete; awaiting review, not approval or merge
2 participants
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
50eb5fdf8e42ea506717ebc2d50d16cbaa960960↑ Full Reactor.Tests suite (16,960) and all DataGrid and async-resource selftests pass locally.
↑ Every regression test added during review was mutation-checked: it fails with its fix reverted.
↑ Local
/perfDataGrid leg within noise vs main (measured before the later review rounds).↓ Shared
UseInfiniteResourcebehavior changed for every caller, not only the grid.Summary
The DataGrid now pages only through
UseDataSource/UseInfiniteResource, and the oldDataPageCachepath is gone, along withReactorFeatureFlags.UseHookBasedPaging. The hook path needed a few things the old default did before it could take over:ServerSort/ServerFilter. A new internalDataGridPagingSource<T>loads the rows in one request (still capped byMaxClientFallbackPageSize), sorts or filters them, and hands the whole result back as the first page, so every row is loaded at once like before.QueryCachewhen you returned to an earlier sort, even after the data changed. The grid now drops its cached pages when the request changes and on unmount.InfiniteResource.Itemsis now a view over the loaded pages instead of aTotalCount-sized array rebuilt on every page change. Evicted pages release their cache entry, in-flight pages don't count toward the cap, and the rows in view stay loaded when pages a fast scroll asked for land late.InfiniteResource.Refresh()keeps the known total while page 0 reloads, as it was documented to, so an observable source'sDataChangedno longer resets the scroll position.DataGridState.LoadDataAsynckeeps working. It drives the same hook state through a small core-internalDetachedDataSourceResource<T>(noQueryCache), completes when the first page is in, and throws if it fails.Linked issue / spec
Relates to #1819. Finishes spec 020 §11.3 (docs/specs/020-async-resources-design.md).
Test plan
dotnet test tests/Reactor.Tests: 16,960 passed.tests/Reactor.DocPipeline.Tests: 593 passedDataGridPagingSourceTests(fallback, headless loads, cancellation, superseded loads, value-type rows, page cap), plusInfiniteResourceTestsandUseInfiniteResourceTestscases for the view, eviction, refresh and source-side cancellationdotnet run --project tests/Reactor.AppTests.Host -- --self-test --filter "DataGrid": 0 failures, including newDataGridParityFixturesfor client sort/filter on screen, refetch on returning to a sort, rows landing after a scroll, observable sources (incl. worker thread and keeping the scroll position), search, the page cap, late pages, failed pages and failed refreshes--filter "Async"selftests: 0 failuresdotnet build Reactor.slnx --no-restore -c Release: clean except the VS extension projects, which couldn't restore from nuget.org on my machine. CI'sBuild solutionpasses./perfDataGrid leg vs main: all metrics within noisereactor.api.txtcopies, the reference docs and the edited guide pagesRisk / breaking changes
Removed public API:
DataPageCache<T>,CacheBlock<T>,BlockStatus,ReactorFeatureFlags.UseHookBasedPaging,DataGridState<T>.PageCacheandRowKeyCache.DataGridState<T>.HookResourceis renamedRowsResourceandSetHookResourceis now internal. The CHANGELOG has a member-by-member migration.Behavior to know about: in client-side sort/filter mode
TotalCountis the number of rows shown, and shift-click now selects a range whenever every row is loaded (it used to only in that mode). TheUseInfiniteResourcechanges (items view, eviction, cancellation, refresh) apply to every user of the hook, not just the grid.