-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
When doing shell navigation with Shell.Current.GoToAsync(state) in a maui project and the destination page's view model implements IQueryAttributable, the implementation of IQueryAttributable.ApplyQueryAttributes(query) will be called to pass on query attributes, even when no data is passed into Shell.Current.GoToAsync(state).
However, this behavior is observed to be missing from Tabs defined in AppShell.xaml, with view models that also implement IQueryAttributable but their implementation of IQueryAttributable.ApplyQueryAttributes(query) were not called.
Steps to Reproduce
For tabs:
- Create a new MAUI app
- Define a tab bar in AppShell.xaml with some new
Pages as its tabs - Add view model classes for each of the tabbed pages that would implement
IQueryAttributable - Put breakpoints or console logs in vm's
ApplyQueryAttributes(query)method - Run the app and switch between the tabs
Expected behavior: debugger breaks at ApplyQueryAttributes(query)/console log is displayed
Actual behavior: no breakpoints hit/no console logs displayed
For regular page navigation:
6. Add a new page and register its route with Routing.RegisterRoute(nameof(NewPage), typeof(NewPage));
7. Add a button to one of the pages with its Clicked event handler executing Shell.Current.GoToAsync(nameof(NewPage))
8. Repeat step 3 and 4 for the new page
9. Run the app and click on the button
Expected behavior: debugger breaks at ApplyQueryAttributes(query)/console log is displayed even though no query attributes are supplied
Actual behavior: matches expectation
Link to public reproduction project repository
https://github.com/dk-mushiyoke/MauiTabQueryRepro
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS, Android
Affected platform versions
iOS 16.2, android 31
Did you find any workaround?
Not yet
Relevant log output
No response