-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
A client I am working for has a LayoutComponent that has various data functions such as CRUD + Search. Upon selecting an object to edit it uses NavigationManager to navigate.
Once the child content has updated, the layout needs to update its state. However, we cannot wait until the navigation is complete because NavigateTo is synchronous.
The navigation process might take a long time due to a modal "Do you want to cancel your changes" confirmation that is hooked into NavigationManager.RegisterLocationChangingHandler.
Describe the solution you'd like
Request 1
I wrote something myself, but it isn't ideal. My biggest problem is not being able to know if the navigation has been cancelled so that I can cancel the task immediately. Could we have a "Task NavigationCancelled" property on LocationChangingContext?
Request 2
Add NavigateToAsync overloads to NavigationManager.
I'm not sure at which point the task should be marked as completed
- After all LocationChangingHandlers have approved?
- After LocationChanged event has fired?
- After LocationChanged event + the page SetParametersAsync has first completed?
- Something else?
Option 2 might be best?
Additional context
Not sure how this would work with a page's IDisposable.Dispose being called whilst it navigates asynchronously to another page and awaits the result.