-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Navigation Lifecycle events #28527
Comments
@captainsafia I hope you still want to co-author this design proposal with me. Feel free to modify it. |
Hi, I know I'm one of many (countless many), but my approach to this has changed since I first registered an interest a year ago. At that point i thought this was a must, but as my "knowledge" increased I realised there are more than x ways to skin a cat (x++ to play on a pun). I no longer use my "alternative" router to get around the problem. See Inline Dialog for my most recent solution. So maybe the solution is "Education" rather than what is proposed. Would help in any shape or form if asked - I'm bored silly in COVID lockdown in the UK. |
Thanks for contacting us. |
Thanks for opening this issue, @MariovanZeist! Closing this in favor of #14962 until there is capacity to flesh out the design for this. We'll use this issue and the PR as a basis for that then. |
Summary
We would like to implement a Navigation lifecycle event, that should be called BEFORE navigation is performed, with the ability to cancel that navigation.
Motivation and goals
The main reason for this lifecycle event is that currently, we have no way of canceling a navigation event, which is useful if for example the user has made some changes in a form, but navigates away from that page before those changes could be stored.
For reference, some work has already been done in #24417 ,
One of the problems we face in that PR is that we want the event to be asynchronous. So using an EventHandler is out of the question. Also the location on where to place this event (Navigationmanager, Router) is under discussion.
In scope
Canceling navigation Lifecycle events.
Out of scope
Risks / unknowns
The performance issue I can think of is that every navigation event (clicking a href for example) in Serverside Blazor would incur an additional client/server callback, even when no one is listening. This can be mitigated by only calling the lifecycle event when a listener is actually supplied. (This has been addressed in the PR)
Examples
The text was updated successfully, but these errors were encountered: