Skip to content

Navigation Cancellation Support for NavigateAsync and NavigateAndWaitAsync #106

@gentledepp

Description

@gentledepp

What is missing?

When a Page A navigates to Page B, Page B may determine in its InitializeAsync method, that the navigation is incorrect and should be cancelled.
This is currently not possible.

How should this be implemented

The easies option is to let Page B call INavigator.BackAsync.
Should a navigation still be "in progress", that flow should be cancelled.

In our example, Page A's navigation to Page B is still in progress when Page B calls INavigator.BackAsync in it's InitializeAsync method.
In that case, the INavigator should simply navigate back to Page A

Why is this feature important?

  • Conditional Navigation: Pages can decide at runtime whether
    they should be displayed based on user permissions, data
    availability, or other conditions
  • User Experience: Prevents users from seeing pages that should
    be redirected or cancelled
  • Navigation Chains: Supports complex navigation flows where
    pages navigate to other pages that might cancel the entire
    chain

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions