You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Prevent user from leaving page with incomplete form #996
It's quite easy to accidentally leave the page or close a modal before you've finished filling it out. Most notably if you're on a longer form like the instance create.
To prevent this, can we ask for confirmation to discard changes from the user. Looks like this can be done with React Router Prompt.
I can work on styling for this – to be used on both the side modals and full-page forms. Looks like this uses a native prompt dialog
I'm not sure what the relative priority of this is. I added it in the first customer demo milestone given that I think @benjaminleonard is actively working on it.
Activity
benjaminleonard commentedon Jun 29, 2022
Looks like Prompt is not supported in React Router 6
david-crespo commentedon Jun 29, 2022
As far as I can tell they're not actively working on that, but people have posted workarounds:
remix-run/react-router#8139 (comment)
benjaminleonard commentedon Jun 29, 2022
Just saw that, looks promising!
just-be-dev commentedon Jun 30, 2022
I'm not sure what the relative priority of this is. I added it in the first customer demo milestone given that I think @benjaminleonard is actively working on it.
benjaminleonard commentedon Jun 30, 2022
I started experimenting in a branch to recreate
Prompt– but I am running into an error. I'll have another stab at this later.benjaminleonard commentedon Jan 16, 2023
remix-run/react-router@bb7590a
The blocker is returning to react router 🎉
david-crespo commentedon Feb 6, 2023
Calling it a nice to have/followup for now, open for debate. It's pretty easy to do now that they brought it back to RR.
benjaminleonard commentedon Feb 28, 2023
Did a little test and is easy enough to add using
formState.isDirtyanduseBlocker— but first we'll need a regular modal component for the popup.