Block navigation until form is submitted/rejected

How can I prevent navigation from taking place when the user is busy with a form?

I found one way of doing it which is a bit cumbersome.I set a global state variable when opening the form and remove the state variable when the form is submitted/abandoned. All of my routes are async so I then check if the state variable is set in the async method and if it is set I reject the navigation.

Hopefully there is a better way someone knows about.

1 Like

I agree that would be the way to go