Skip to content

fix(reconciler): cover SplitView/Viewbox in context-consumer subtree walk (#811 follow-up) - #962

Merged
Alexandre Zollinger Chohfi (azchohfi) merged 2 commits into
mainfrom
azchohfi-fix-context-skip-gaps
Jul 31, 2026
Merged

Alexandre Zollinger Chohfi (azchohfi) merged 2 commits into
mainfrom
azchohfi-fix-context-skip-gaps

Conversation

@azchohfi

Copy link
Copy Markdown
Collaborator

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). HasConsumedContextChangedInSubtree walks the subtree via ForEachReactorChildControl, which handled Panel / ItemsRepeater / Border / ScrollViewer / UserControl / ContentControl but not SplitView (Pane/Content) or Viewbox (Child) — both real reactor child hosts that are neither Panel nor ContentControl. A UseContext(...) 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 on IV1HandlerEntry; 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

ForEachReactorChildControl is 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 a SplitView/Viewbox is now correctly collected/invoked (previously missed) — a strict improvement, single-traversal so no double-invoke, and the SplitView arm honors the visitor early-out for navigation cancellation.

Tests

  • Issue811_SplitViewPane_ContextConsumerRerenders — consumer in a reference-stable SplitView.Pane re-renders on provider change (RenderCount stays 1 without the fix).
  • Issue811_ViewboxNested_ContextConsumerRerenders — consumer nested in a reference-stable Viewbox re-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 coarse HasActiveValues gate against over-rendering).
  • CHANGELOG ### Fixed entry 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 failures
  • Regression: Navigation (19), SplitView (2), Viewbox (2), Skip (31), Context (15) — all 0 failures

Known follow-ups (not in this PR)

  • Descriptor-driven subtree walk to cover every named-slot host generically.
  • The coarse HasActiveValues gate still walks stable subtrees speculatively whenever any provider is active; a context-version signal would avoid the walk when no provided value changed.

…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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ForEachReactorChildControl to explicitly traverse SplitView (Content + Pane) and Viewbox (Child).
  • Add self-test fixtures covering the SplitView/Viewbox traversal 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.

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

📦 Build metrics

Artifact sizes for c60533f vs the base branch (4a579e8).

Packages (compressed .nupkg)

Artifact base PR Δ
Microsoft.UI.Reactor.nupkg 1.60 MB 1.60 MB +77 B (0.00%) ≈
Microsoft.UI.Reactor.Advanced.nupkg 475.5 KB 475.5 KB +2 B (0.00%) ≈
Microsoft.UI.Reactor.Devtools.nupkg 278.2 KB 278.2 KB -1 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor

Artifact base PR Δ
Reactor.Analyzers.dll 354.5 KB 354.5 KB +0 B (0.00%) ≈
Reactor.dll 2.38 MB 2.38 MB +0 B (0.00%) ≈
Reactor.Localization.Generator.dll 16.0 KB 16.0 KB +0 B (0.00%) ≈
Reactor.Wrappers.Abstractions.dll 10.5 KB 10.5 KB +0 B (0.00%) ≈
Reactor.Wrappers.Generator.dll 99.5 KB 99.5 KB +0 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor.Advanced

Artifact base PR Δ
Reactor.Advanced.dll 1014.0 KB 1014.0 KB +0 B (0.00%) ≈

Assemblies in Microsoft.UI.Reactor.Devtools

Artifact base PR Δ
Microsoft.UI.Reactor.Devtools.dll 777.5 KB 777.5 KB +0 B (0.00%) ≈

No size change beyond the noise floor. ✅

✅ 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.

@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

🧪 Merged coverage

Coverage for c60533f vs the base branch (05b831c) — unit + selftest merged.

Metric base PR Δ
Line 85.72% 85.72% 0.00 pp ≈
Branch 77.19% (900/1166) 77.10% (899/1166) -0.09 pp ≈

No coverage change beyond the noise floor. ✅

✅ 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.

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
Copilot AI review requested due to automatic review settings July 31, 2026 04:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.

@azchohfi
Alexandre Zollinger Chohfi (azchohfi) merged commit 03414f2 into main Jul 31, 2026
21 checks passed
@azchohfi
Alexandre Zollinger Chohfi (azchohfi) deleted the azchohfi-fix-context-skip-gaps branch July 31, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants