Skip to content
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

Block navigation from the editor when there are unsaved changes #21

Closed
david-qz opened this issue Dec 13, 2022 · 3 comments
Closed

Block navigation from the editor when there are unsaved changes #21

david-qz opened this issue Dec 13, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@david-qz
Copy link
Owner

I'm not sure how to do this with react-router. If all else fails I guess the editor could be split off into a separate document and we could use window.onbeforeunload to pop up the native confirmation box.

@david-qz david-qz added the enhancement New feature or request label Dec 13, 2022
@forestheims
Copy link

for the conditional prevention of navigation react-router 5 has <Prompt />

though I've heard this is deprecated for react router 6

remix-run/react-router#8139 (comment)

^ this goes into depth on it more. You might find some other helpful links in this conversation

@david-qz
Copy link
Owner Author

That issue thread was really useful! I had to downgrade react-router-dom to v6.3.x from v6.4.x to use the implementations shared in that thread, but they seem to work well. I will have to make some UX decisions now.

@david-qz
Copy link
Owner Author

Closed via c08d639

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants