Skip to content

Commit 0c758de

Browse files
authored
Fix NavigateAndReset navigation for Maui (#4076)
<!-- Please be sure to read the [Contribute](https://github.com/reactiveui/reactiveui#contribute) section of the README --> **What kind of change does this PR introduce?** <!-- Bug fix, feature, docs update, ... --> Fix closes #3820 **What is the current behavior?** <!-- You can also link to an open issue here. --> #3820 **What is the new behavior?** <!-- If this is a feature change --> Changed RoutedViewHost to be a partial class to allow splitting its implementation. Refactored navigation stack comparison to use the StacksAreDifferent() method for improved clarity and maintainability. **What might this PR break?** If currently calling NavigateAndReset at startup may cause navigation to end up in a different place. **Please check if the PR fulfills these requirements** - [ ] Tests for the changes have been added (for bug fixes / features) - [ ] Docs have been added / updated (for bug fixes / features) **Other information**:
1 parent 84d4613 commit 0c758de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ReactiveUI.Maui/RoutedViewHost.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace ReactiveUI.Maui;
1515
/// </summary>
1616
/// <seealso cref="NavigationPage" />
1717
/// <seealso cref="IActivatableView" />
18-
public class RoutedViewHost : NavigationPage, IActivatableView, IEnableLogger
18+
public partial class RoutedViewHost : NavigationPage, IActivatableView, IEnableLogger
1919
{
2020
/// <summary>
2121
/// The router bindable property.
@@ -76,7 +76,7 @@ public RoutedViewHost()
7676

7777
Router?
7878
.Navigate
79-
.Where(_ => Navigation.NavigationStack.Count != Router.NavigationStack.Count)
79+
.Where(_ => StacksAreDifferent())
8080
.ObserveOn(RxApp.MainThreadScheduler)
8181
.SelectMany(_ => PagesForViewModel(Router.GetCurrentViewModel()))
8282
.SelectMany(async page =>

0 commit comments

Comments
 (0)