Skip to content

Allow cancellation of navigation with bUnits NavigationManager #804

@linkdotnet

Description

@linkdotnet

With the recent merge of this PR: dotnet/aspnetcore#42638 (here the issue which tracks the topic: dotnet/aspnetcore#42877) users can intercept the NavigationManager and prevent redirects. To make it work we have to add some logic in the NavigateToCore function.

Here is an inspiration how it is done in the PR for the RemoteNavigationManager: https://github.com/dotnet/aspnetcore/blob/d1558107b97d2471e9a0aa5d008b511ead908fa7/src/Components/Server/src/Circuits/RemoteNavigationManager.cs#L84

Goal

The user should have means to simulate the cancellation behaviour in a bUnit test. That said if he has a NavigationLock component which would prevent the navigation, we should have the same behaviour in bUnit. That includes also no new item on the NavigationHistory stack. No change of BaseUri or Uri.

Analysis

I tried to use the feature as it is already merged to main, but unfortunately the nightly builds don't include this function at the moment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions