-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Ability to cancel a Navigation event #24417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
MariovanZeist
wants to merge
18
commits into
dotnet:main
from
MariovanZeist:LocationChangingEvent_MvZ
Closed
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
9052a31
Implement LocationChangingEvent
MariovanZeist d0c9be5
Added E2E Test for cancelation
MariovanZeist 47a2991
Merged from master
MariovanZeist 6965458
Update src/Components/Components/src/NavigationManager.cs
MariovanZeist 76a5bed
Merge remote-tracking branch 'upstream/master' into LocationChangingE…
MariovanZeist aa9713b
Resynced with master
MariovanZeist 73a98da
Merge branch 'LocationChangingEvent_MvZ' of https://github.com/Mariov…
MariovanZeist c539f29
Source cleanup
MariovanZeist 7bdc0ca
Added 4 more tests, for canceling external and invalid routes.
MariovanZeist 6fe7b6b
merged from master
MariovanZeist debb1b0
Fix for uninitialized JSRuntime
MariovanZeist 82605a1
Fix for Early initialzation problem.
MariovanZeist dc8f6bf
LocationChanging event is now also called when ForceLoad is set in Na…
MariovanZeist e08173f
Added E2E test for Forceload=True
MariovanZeist 9bd8d90
Merge remote-tracking branch 'upstream/master' into LocationChangingE…
MariovanZeist c719e38
Updated publicAPI
MariovanZeist 76b1aaa
Merge remote-tracking branch 'upstream/master' into LocationChangingE…
MariovanZeist 1d65816
Changed LocationChanging implementation from an Event to a Handler sy…
MariovanZeist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/Components/Components/src/Routing/LocationChangingEventArgs.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
|
||
namespace Microsoft.AspNetCore.Components.Routing | ||
{ | ||
/// <summary> | ||
/// <see cref="EventArgs" /> for <see cref="NavigationManager.LocationChanging" />. | ||
/// </summary> | ||
public class LocationChangingEventArgs : EventArgs | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of <see cref="LocationChangingEventArgs" />. | ||
/// </summary> | ||
/// <param name="location">The location.</param> | ||
/// <param name="isNavigationIntercepted">A value that determines if navigation for the link was intercepted.</param> | ||
/// <param name="forceLoad">A value that shows if the forceLoad flag was set during a call to <see cref="NavigationManager.NavigateTo" /> </param> | ||
public LocationChangingEventArgs(string location, bool isNavigationIntercepted, bool forceLoad) | ||
{ | ||
Location = location; | ||
IsNavigationIntercepted = isNavigationIntercepted; | ||
ForceLoad = forceLoad; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the location we are about to change to. | ||
/// </summary> | ||
public string Location { get; } | ||
|
||
/// <summary> | ||
/// Gets a value that determines if navigation for the link was intercepted. | ||
/// </summary> | ||
public bool IsNavigationIntercepted { get; } | ||
|
||
/// <summary> | ||
/// Gets a value if the Forceload flag was set during a call to <see cref="NavigationManager.NavigateTo" /> | ||
/// </summary> | ||
public bool ForceLoad { get; } | ||
|
||
/// <summary> | ||
/// Gets or sets a value to cancel the current navigation | ||
/// </summary> | ||
public bool Cancel { get; set; } | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.