Skip to content

Tabs defined in AppShell.xaml does not invoke its view model's IQueryAttributable.ApplyQueryAttributes(query) implementaion #13537

@dk-mushiyoke

Description

@dk-mushiyoke

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:

  1. Create a new MAUI app
  2. Define a tab bar in AppShell.xaml with some new Pages as its tabs
  3. Add view model classes for each of the tabbed pages that would implement IQueryAttributable
  4. Put breakpoints or console logs in vm's ApplyQueryAttributes(query) method
  5. 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

Metadata

Metadata

Assignees

Labels

area-controls-shellShell Navigation, Routes, Tabs, Flyoutp/2Work that is important, but is currently not scheduled for releasepartner/cat 😻this is an issue that impacts one of our partners or a customer our advisory team is engaged withpartner/syncfusionIssues / PR's with Syncfusion collaborationplatform/androidplatform/ioss/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions