Reactiveui: [BUG] RoutedViewHost Example from ReactiveUI Handbook doesn't work as expected

Created on 17 Jun 2019  路  4Comments  路  Source: reactiveui/ReactiveUI

Describe the bug
RoutedViewHost doesn't go back to the default content. Also you must click on Go First button twice in order to enable Go Back button.

Steps To Reproduce
Just follow guide here https://reactiveui.net/docs/handbook/routing/ and compile Routing example.

Expected behavior
Going back to default content & enable NavigateBack after one click on GoFirst

Screenshots
SNcBK4hcRQ

Environment

  • OS: Win 10 build 1803
  • Version 9.17.4
  • Device: PC
Hacktoberfest bug help wanted

Most helpful comment

@M0n7y5 I was able to reproduce your issue last night. I am going to find a solution. Seems that there is a disconnect for sure in the docs. The video of the working sample in the docs, is indeed different than what you get by implementing it.

Thank You for reporting this.

All 4 comments

Do you happen to have the code that generated this issue in a repository we can access? Just want to be sure there is no additional code that might be causing issues. Also going to make the assumption this is WPF and not UWP or WinForms.

@RLittlesII No i don't have this code in online repository. It's just exact code from online Handbook (ReactiveUI website). And yes this is WPF ... i forgot to mention it.

@M0n7y5 I was able to reproduce your issue last night. I am going to find a solution. Seems that there is a disconnect for sure in the docs. The video of the working sample in the docs, is indeed different than what you get by implementing it.

Thank You for reporting this.

To have the behavior from the GIF recording located at https://reactiveui.net/docs/handbook/routing/ the following line of code from the tutorial:

GoBack = Router.NavigateBack;

Should be replaced with this line:

GoBack = ReactiveCommand.CreateFromObservable(
      () => Router.NavigateBack.Execute(Unit.Default));

Although there is a risk to get the IndexOutOfBoundsException. Ideally need to define the canGoBack condition via a call to WhenAnyValue and pass it to the reactive command. Probably we should simply replace the GIF from the tutorial to another one for simplicity, and mention other back button handling scenarios.

Was this page helpful?
0 / 5 - 0 ratings