Repository navigation
fix: adjust routenotifier logic - #3028
Conversation
547a514 to
3e42c2b
Compare
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-moss-0c5b8040f-3028.eastus2.azurestaticapps.net |
There was a problem hiding this comment.
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
RouteNotifierto use the root region captured at navigation start, and include the resolvedRouteinRouteChangedEventArgs. - Update
PanelVisiblityNavigatorto only reassign region parent for the currently visible tab/content. - Add a new
Uno.Extensions.Navigation.WinUI.Testsproject with aGiven_RouteNotifiertest 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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-moss-0c5b8040f-3028.eastus2.azurestaticapps.net |
- 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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-moss-0c5b8040f-3028.eastus2.azurestaticapps.net |
1 similar comment
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://delightful-moss-0c5b8040f-3028.eastus2.azurestaticapps.net |
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:
Given_RouteNotifierwith multiple tests to verify thatRouteChangedevents provide accurate and complete route, region, and navigator information after navigation actions.TestPageOne,TestPageTwo,TestPageThree) for use in navigation tests. [1] [2] [3]Uno.Extensions.Navigation.WinUI.Tests.csprojto 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:
RouteChangedEventArgsto include aRouteproperty, populated with the current route after navigation, and adjusted its constructor accordingly. [1] [2]RouteNotifierto capture the root region at the start of navigation and use it when raisingRouteChangedevents, 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:
PanelVisiblityNavigatorto only reassign the region parent for the currently visible control, preventing inactive tab content regions from being incorrectly re-added as children and ensuringGetRoute()reports the correct active route.