MBS-14271: Add form unload hook to event/genre forms #3727
Open
reosarevok wants to merge 2 commits intometabrainz:masterfrom
Open
MBS-14271: Add form unload hook to event/genre forms #3727reosarevok wants to merge 2 commits intometabrainz:masterfrom
reosarevok wants to merge 2 commits intometabrainz:masterfrom
Conversation
These are currently not warning the user if they try to close the page with pending changes. This just uses the useFormUnloadWarning hook to warn the user when relevant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement MBS-14271
Problem
Currently users can close the event and genre React forms with no warning even if there are pending changes.
Solution
This cherry-picks the
useFormUnloadWarninghook I'm adding during the recording conversion (#3378) to already prevent leaving without warning in our existing React entity forms, event and genre.AI usage
None
Testing
Manually, by ensuring the forms still close without warning if no changes have been made, then making changes in the forms and making sure they do ask when I try to close them. Keep in mind this only works after the input has been marked as changed, which means for something like the name it only warns after the field has been blurred (if the only change is the name and you
ctrl+wwhile still on the name field, it won't trigger). It still seems much better than nothing though.