Open meopoc opened 2 months ago
Hi I'm an AI powered bot that finds similar issues based off the issue title.
Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
Reproduction project repository attached
This issue has been verified using Visual Studio 17.12.0 Preview 1.0 (8.0.80 & 8.0.72 & 8.0.21). Can repro on Android platform.
Yea :-/ the OnNavigatedTo
unfortunately don't fire in the most consistent order
I have a PR here building towards this effort https://github.com/dotnet/maui/pull/23420
@PureWeen HI, Thanks for the reply. Seems odd considering the query properties are likely to be needed in the page lifecycle events. It looks to me that ApplyQueryAttributes is the issue as this fires after the OnAppearing too.
Do you know of any workaround whereby I can use query properties in a lifecycle event?
On further investigation this only appears to be an issue the first time the "PageWithFlyoutMenu" is navigated to. I've attached another repo with console logging and fixed a couple of navigation issues.
Please note the Shell.Current.FlyoutContent is set just prior to navigating to "PageWithFlyoutMenu"
FYI only tested on Android.
Description
My app navigates to a MainPage with a menu that then navigates through other pages in the app until it reaches a page that requires a Flyout Menu (at which point I set the
Shell.Current.FlyoutContent
).So
MainPage > PageA > PageB > PageWithFlyoutMenu
I'm performing the navigation as follows
MainPage to PageA:
await Shell.Current.GoToAsync($"PageA", true);
Lifecycle event order:
Constructor
>ApplyQueryAttributes
>OnAppearing
>OnNavigatedTo
PageA to PageB:
await Shell.Current.GoToAsync($"PageB");
Lifecycle event order:
Constructor
>ApplyQueryAttributes
>OnAppearing
>OnNavigatedTo
PageB to PageWithFlyoutMenu:
Shell.Current.FlyoutContent = IPlatformApplication.Current?.Services.GetService<MenuPage>()
;await Shell.Current.GoToAsync($"///PageWithFlyoutMenu-1");
Lifecycle event order:
Constructor
>OnAppearing
>OnNavigatedTo
>ApplyQueryAttributes
The issue here is that
ApplyQueryAttributes
is the last to be invoked.AppShell is as follows:
And I have the following routes registered:
Can anyone shed any light on why this would be?
Thanks in advance
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.20 SR4
Is this a regression from previous behavior?
Not sure, did not test other versions
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 14
Did you find any workaround?
No response
Relevant log output
No response