Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoToAsync returns user to desired page but previous page's OnAppearing() is triggered #20141

Open
d-harding opened this issue Jan 24, 2024 · 3 comments
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout area-navigation NavigationPage platform/android 🤖 platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@d-harding
Copy link

Description

When navigating pages with GoToAsync() in Shell, changing page hierarchy will result in OnAppearing() being called on a page that is not in the target navigation url/stack.

Steps to Reproduce

  1. Run app on Android (or iOS) (current: //MainPage)
  2. Click Go to Page 1 (current: //MainPage/Page1)
  3. Click Go to Page 2 (current: //MainPage/Page1/Page2)
  4. Click Go to SubMainPage (current: //MainPage/SubMainPage)
  5. Open Flyout or Command and click Return to MainPage (current: //MainPage)

When Return to MainPage is clicked, the command is executing the following await Shell.Current.GoToAsync($"//{nameof(MainPage)}");. This should return the user directly to the page based on the URL, however, OnAppearing will be triggered for Page2, which is unwanted and not desired.

Routes for MainPage and SubMainPage are defined in AppShell.xaml, where Page1 and Page2 are using RegisterRoute in AppShell.xaml.cs as to only show Back button.

Link to public reproduction project repository

https://github.com/d-harding/maui-pageflow

Version with bug

Unknown/Other

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

iOS, Android, I was not able test on other platforms

Affected platform versions

No response

Did you find any workaround?

No

Relevant log output

No response

@d-harding d-harding added the t/bug Something isn't working label Jan 24, 2024
@SmartmanApps
Copy link

Possibly related to this issue (same root cause?) there are already known issues with OnAppearing() and IsPresented not running at the correct times (in this case with a Flyout menu, with no Shell being used). See #15767

@samhouts samhouts added the area-navigation NavigationPage label Jan 25, 2024
@PureWeen PureWeen added the area-controls-shell Shell Navigation, Routes, Tabs, Flyout label Jan 26, 2024
@PureWeen PureWeen added this to the Backlog milestone Jan 26, 2024
@ghost
Copy link

ghost commented Jan 26, 2024

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Mar 7, 2024
@XamlTest
Copy link

XamlTest commented Mar 7, 2024

Verified this on VS 17.10.0 Preview 1.0(8.0.6). Repro on Windows 11, Android 14.0-API34, iOS 17.2 and MacCatalyst with below Project:
maui-pageflow.zip

@samhouts samhouts removed s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 3, 2024
@samhouts samhouts added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-shell Shell Navigation, Routes, Tabs, Flyout area-navigation NavigationPage platform/android 🤖 platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants