GoToAsync returns user to desired page but previous page's OnAppearing() is triggered #20141
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
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
//MainPage
)Go to Page 1
(current://MainPage/Page1
)Go to Page 2
(current://MainPage/Page1/Page2
)Go to SubMainPage
(current://MainPage/SubMainPage
)Return to MainPage
(current://MainPage
)When
Return to MainPage
is clicked, the command is executing the followingawait Shell.Current.GoToAsync($"//{nameof(MainPage)}");
. This should return the user directly to the page based on the URL, however,OnAppearing
will be triggered forPage2
, which is unwanted and not desired.Routes for
MainPage
andSubMainPage
are defined inAppShell.xaml
, wherePage1
andPage2
are usingRegisterRoute
inAppShell.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
The text was updated successfully, but these errors were encountered: