Ability to detect and abort page leave in app router. #59027
ken-spencer
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
In my application, I have a requirement to warn a user if they are navigating away from a page if there are unsaved changes.
Non-Goals
Background
Previously I could accomplish this using the following features:
Router.events.on('routeChangeStart', routeChangeStart);
Router.router.abortComponentLoad();
Now that these are no longer availible, I am at a loss as to how to implement this feature. The useEffect solution mentioned in the manual does not allow me to stop a user from navigating away from the page.
Proposal
Can we restore the router events and abort for the app router? Or provide an alternative that can handle this use case?
Beta Was this translation helpful? Give feedback.
All reactions