Repository navigation
fix(reconciler): cover SplitView/Viewbox in context-consumer subtree walk (#811 follow-up) - #962
Conversation
…walk (#811) Follow-up to #812. HasConsumedContextChangedInSubtree relies on ForEachReactorChildControl, which did not descend into SplitView (Pane/Content) or Viewbox (Child) hosts, so a context consumer under one of those behind a reference-stable skip stayed stale. Add explicit arms for both (the descriptor-driven generalization for the long tail of named-slot hosts is a tracked follow-up). Also adds selftests for the SplitView.Pane and Viewbox-nested cases plus a negative test proving an active-but-unchanged provider still skips stable subtrees, and a CHANGELOG entry. Unmount/pooling callers early-return for V1 controls before the shared walk, so the new arms only affect the context walk and the nav-lifecycle traversals (which now correctly reach consumers nested under these hosts). Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76b97117-db7a-4d10-820c-e4aafd5a4fa4
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up for issue #811, extending the reconciler’s subtree traversal so context consumers nested under SplitView and Viewbox hosts are discovered during skip-path context invalidation checks, ensuring UseContext(...) consumers re-render when their consumed value changes even behind reference-stable skips.
Changes:
- Extend
Reconciler.ForEachReactorChildControlto explicitly traverseSplitView(Content+Pane) andViewbox(Child). - Add self-test fixtures covering the
SplitView/Viewboxtraversal arms plus a negative test to guard against over-rendering when the provider value is unchanged. - Add a CHANGELOG “Fixed” entry documenting the resolved #811 scenario and the expanded traversal coverage.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Reactor/Core/Reconciler.cs | Adds SplitView and Viewbox child-slot traversal to the shared subtree-walk helper used by context-consumer invalidation and other traversals. |
| tests/Reactor.AppTests.Host/SelfTest/Fixtures/Issue811ContextConsumerSkipFixtures.cs | Adds regression selftests for SplitView.Pane and Viewbox.Child consumer re-rendering, plus a negative test for unchanged provided values. |
| tests/Reactor.AppTests.Host/SelfTest/SelfTestFixtureRegistry.cs | Registers the new Issue #811 follow-up fixtures in the host selftest registry. |
| CHANGELOG.md | Documents the fix and notes the additional host coverage in the subtree walk. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📦 Build metricsArtifact sizes for Packages (compressed .nupkg)
Assemblies in Microsoft.UI.Reactor
Assemblies in Microsoft.UI.Reactor.Advanced
Assemblies in Microsoft.UI.Reactor.Devtools
No size change beyond the noise floor. ✅ ✅ smaller / |
🧪 Merged coverageCoverage for
No coverage change beyond the noise floor. ✅ ✅ higher / |
The traversal arm visits both SplitView.Content and Pane, but only Pane had a fixture; add a Content-slot consumer fixture so a regression dropping the Content visit is caught. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76b97117-db7a-4d10-820c-e4aafd5a4fa4
Follow-up to #812 — close the remaining review gaps for issue #811
#812 fixed context consumers behind reference-stable child skips and covered the positional, keyed, and hinted skip sites. This closes the remaining gaps identified in that review, so they don't need another round on the contributor's PR.
What this fixes
Traversal blind spot (correctness).
HasConsumedContextChangedInSubtreewalks the subtree viaForEachReactorChildControl, which handledPanel/ItemsRepeater/Border/ScrollViewer/UserControl/ContentControlbut notSplitView(Pane/Content) orViewbox(Child) — both real reactor child hosts that are neitherPanelnorContentControl. AUseContext(...)consumer under one of those, behind a reference-stable skip, stayed stale. Added explicit arms for both.The authoritative child slots live on each control's V1 children strategy (
SingleContent.GetCurrentChild/NamedSlots). A fully strategy-driven walk is the principled generalization for the long tail of named-slot hosts (NavigationView,TitleBar,TeachingTip,SemanticZoom, …) and would require a new enumeration method onIV1HandlerEntry; I've left that as a tracked follow-up and covered the two common concrete hosts here to keep this change low-risk.Blast-radius note
ForEachReactorChildControlis shared. The unmount/pooling callers (UnmountRecursive,UnmountAndCollect) early-return for V1 controls before reaching the shared walk, so the new arms are unreachable there — no double-unmount. The two nav-lifecycle callers (CollectLifecycleHooksRecursive,InvokeNavigatingFrom) do reach it, so a nav-lifecycle hook nested under aSplitView/Viewboxis now correctly collected/invoked (previously missed) — a strict improvement, single-traversal so no double-invoke, and theSplitViewarm honors the visitor early-out for navigation cancellation.Tests
Issue811_SplitViewPane_ContextConsumerRerenders— consumer in a reference-stableSplitView.Panere-renders on provider change (RenderCount stays 1 without the fix).Issue811_ViewboxNested_ContextConsumerRerenders— consumer nested in a reference-stableViewboxre-renders (covers the Viewbox arm + recursion).Issue811_ActiveButUnchangedContext_StillSkips— negative test: a provider is active every render but its value is unchanged, so the reference-stable consumer must still be skipped (guards the coarseHasActiveValuesgate against over-rendering).### Fixedentry for Bug: pure context changes can be lost behind reference-stable child skip paths #811.Validation
dotnet build src/Reactor/Reactor.csproj— 0 warnings / 0 errors--self-test --filter Issue811— 6 fixtures, 30 checks, 0 failuresNavigation(19),SplitView(2),Viewbox(2),Skip(31),Context(15) — all 0 failuresKnown follow-ups (not in this PR)
HasActiveValuesgate still walks stable subtrees speculatively whenever any provider is active; a context-version signal would avoid the walk when no provided value changed.