Skip to content

fix: adjust routenotifier logic - #3028

Merged
kazo0 merged 3 commits into
mainfrom
dev/sb/route-notifier
Feb 17, 2026
Merged

kazo0 merged 3 commits into
mainfrom
dev/sb/route-notifier

Conversation

@kazo0

@kazo0 kazo0 commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

This pull request adds a new test suite for verifying navigation route change notifications and fixes an issue with region parent assignment in tabbed navigation scenarios. The main changes include introducing comprehensive tests for the route notifier, updating the event arguments and notifier to provide accurate route information, and ensuring region hierarchies remain correct during navigation events.

Navigation Route Notification Improvements:

  • Added a new test class Given_RouteNotifier with multiple tests to verify that RouteChanged events provide accurate and complete route, region, and navigator information after navigation actions.
  • Created three test page classes (TestPageOne, TestPageTwo, TestPageThree) for use in navigation tests. [1] [2] [3]
  • Added a new test project Uno.Extensions.Navigation.WinUI.Tests.csproj to contain and run the navigation UI tests, and registered it with the runtime test runner. [1] [2] [3] [4]

Route Event Argument and Notifier Enhancements:

  • Updated RouteChangedEventArgs to include a Route property, populated with the current route after navigation, and adjusted its constructor accordingly. [1] [2]
  • Modified RouteNotifier to capture the root region at the start of navigation and use it when raising RouteChanged events, ensuring the correct region hierarchy and route are reported even if the region tree changes during navigation. [1] [2] [3] [4]

Tabbed Navigation Region Management Fix:

  • Changed PanelVisiblityNavigator to only reassign the region parent for the currently visible control, preventing inactive tab content regions from being incorrectly re-added as children and ensuring GetRoute() reports the correct active route.

Copilot AI review requested due to automatic review settings February 17, 2026 02:35
@kazo0
kazo0 force-pushed the dev/sb/route-notifier branch from 547a514 to 3e42c2b Compare February 17, 2026 02:36
@github-actions

Copy link
Copy Markdown

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 improves navigation route change notifications in Uno.Extensions.Navigation.UI and adds a new WinUI UI-test project to validate RouteChanged behavior, alongside a fix for region parent assignment in tabbed/panel navigation.

Changes:

  • Fix RouteNotifier to use the root region captured at navigation start, and include the resolved Route in RouteChangedEventArgs.
  • Update PanelVisiblityNavigator to only reassign region parent for the currently visible tab/content.
  • Add a new Uno.Extensions.Navigation.WinUI.Tests project with a Given_RouteNotifier test suite and supporting test pages, and wire it into the runtime test runner.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests.csproj Adds reference to the new navigation UI test project so it runs in the runtime tests app.
src/Uno.Extensions.RuntimeTests/Uno.Extensions.RuntimeTests/App.xaml.cs Forces navigation UI test assembly loading for discovery.
src/Uno.Extensions.Navigation.UI/RouteNotifier.cs Captures root region at StartNavigation and raises RouteChanged with computed route.
src/Uno.Extensions.Navigation.UI/RouteChangedEventArgs.cs Adds Route property and changes constructor signature.
src/Uno.Extensions.Navigation.UI/Navigators/PanelVisiblityNavigator.cs Limits region parent reassignment to the visible control to avoid incorrect route selection.
src/Uno.Extensions.Navigation.UI.Tests/Uno.Extensions.Navigation.WinUI.Tests.csproj Introduces new WinUI navigation UI test project.
src/Uno.Extensions.Navigation.UI.Tests/Given_RouteNotifier.cs Adds tests validating RouteChanged route/region/navigator correctness.
src/Uno.Extensions.Navigation.UI.Tests/Pages/TestPageOne.cs Adds a simple test page for navigation.
src/Uno.Extensions.Navigation.UI.Tests/Pages/TestPageTwo.cs Adds a simple test page for navigation.
src/Uno.Extensions.Navigation.UI.Tests/Pages/TestPageThree.cs Adds a simple test page for navigation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown

@kazo0 kazo0 linked an issue Feb 17, 2026 that may be closed by this pull request
10 of 16 tasks
- Remove unused 'using System.Reflection' (CS8019)
- Remove unused locals receivedArgs/backArgs (CS0219)
- Add backward-compatible constructor overload for RouteChangedEventArgs
- Replace flaky Task.Delay with existing WaitFor pattern
Replace CancellationToken.None with a timeout-based token to avoid
indefinite hangs if the condition is never met.
@github-actions

Copy link
Copy Markdown

1 similar comment
@github-actions

Copy link
Copy Markdown

@kazo0
kazo0 merged commit 28bc6f2 into main Feb 17, 2026
14 checks passed
@kazo0
kazo0 deleted the dev/sb/route-notifier branch February 17, 2026 14:59
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.

IRouteNotifier + NavigationView + MVUX + Navigator not reliable?

3 participants