Skip to content

[BUG] Router.NavigateBack is still broken in some cases #2317

@garyng

Description

@garyng

Describe the bug

This is related to #2286 and #2315, with some more test cases

Steps To Reproduce

Sample: Test.zip

The sample is based on the one provided by #2286

There are three cases (all can be found inside ItemViewModel):

  1. NavigateBack inside Subscribe
    var completedInternally = Observable.Amb(
        Confirm.Select(_ => _),
        Cancel.Select(_ => _),
        Delete.Select(_ => _));
    
    completedInternally.Subscribe(_ =>
    {
        if (HostScreen.Router.NavigationStack.LastOrDefault() == this)
        {
            HostScreen.Router.NavigateBack.Execute().Subscribe(); 
            if (NextViewModel != null)
                HostScreen.Router.Navigate.Execute(NextViewModel).Subscribe();
        }
    });
  2. NavigateBack inside SelectMany
    var completedInternally = Observable.Amb(
            Confirm.Select(_ => _),
            Cancel.Select(_ => _),
            Delete.Select(_ => _))
        .Where(_ => HostScreen.Router.NavigationStack.LastOrDefault() == this)
        .SelectMany(_ => HostScreen.Router.NavigateBack.Execute());
    completedInternally.Subscribe(_ =>
    {
        if (NextViewModel != null)
            HostScreen.Router.Navigate.Execute(NextViewModel).Subscribe();
    });
  3. NavigateBack inside Do
    var completedInternally = Observable.Amb(
            Confirm.Select(_ => _),
            Cancel.Select(_ => _),
            Delete.Select(_ => _))
        .Where(_ => HostScreen.Router.NavigationStack.LastOrDefault() == this)
        .Do(_ => HostScreen.Router.NavigateBack.Execute().Subscribe());
    completedInternally.Subscribe(_ =>
    {
        if (NextViewModel != null)
            HostScreen.Router.Navigate.Execute(NextViewModel).Subscribe();
    });
Case RxUI 11.1.11 RxUI 11.1.6
1
2
3

Expected behavior

It should return to the Main Page when Save is tapped on the Production page.

Environment

  • OS: Android 7-API 24, physical device
  • Version 11.1.11 and 11.1.6
  • Device: Samsung S6

Additional context

I'm quite new to ReactiveUI (using this for my uni's final year project), so it might the case that I am using it all wrong.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions