points
points copied to clipboard
DT-340: Warn the user if they are leaving a story edit page with unsaved changes
Jira Ticket
https://ombulabs.atlassian.net/browse/DT-340
Motivation / Context
Currently if you leave the current page, you can lose information that was not saved. This feature warns you if you are leaving without saving information.
QA / Testing Instructions
- Go to the Edit Story page.
- Edit the story.
- Try to navigate off the page by reloading, pressing the back button in the browser, clicking the logo or the Back button on the page.
- Ensure that you get a popup asking you if are sure you want to reload/go back.
Screenshots:
I will abide by the code of conduct.
Hey @torresga, this looks good; however, maybe we can improve a little bit on the isDirty logic; for example, I tried the following, and the state was still dirty when it probably should not have been.
- Go to the edit page.
- Type 3 letters in the title.
- Click back, the logo, or any action that triggers the modal to alert us we left unsaved changes.
- The alert will pop up as expected; until here, all looks good.
- Then I removed the 3 letters to be in an unchanged state, and clicking any action to get out of the page does not allow me because it says I have unsaved changes when I really don't.
If you need help to follow the described steps, let me know, and we can check it together.