unfoldingWord / gateway-translate

A tool for editing and translating text in USFM markup
MIT License
2 stars 3 forks source link

Prevent loss of unsaved data #107

Closed mandolyte closed 1 year ago

mandolyte commented 1 year ago

After a number of other bug fixes, this one item remains. To replicate:

The changes made are now lost.

The app needs a way to determine if there are unsaved changes and to alert the user.

Suggestion: expose an action from the pk cache context that the app can use to check if any data is unsaved.

mandolyte commented 1 year ago

Prompt: reword and make it look nice

Offer three buttons/actions:

  1. Save: save the data and close the card
  2. Continue closing: close the card without saving (1)
  3. Cancel: return to card

(1) for now the continue closing will not lose the changes since the data is cached in the PK Context Provider.

@larsgson @birchamp

elsylambert commented 1 year ago

Seeing the Warning Prompt for Unsaved data as below:

Screenshot 2023-02-08 at 3 28 55 PM

But, when you click on Continue, the other open card gets closed.

mandolyte commented 1 year ago

@elsylambert Actually both popups are there. If you move the top one you'll see the other. But we obviously should only show the one for which the user has clicked to close.

Also, the way it works right now, the changes are not lost. If you open up Titus again, it will have the changes made. The data is being cached at the PK layer in the app.

Great catch!

elsylambert commented 1 year ago

-Logged with my user account and added a book, made edits and tried to close the card without saving. It showed the warning that there is unsaved data on the specific card. I clicked on Continue and saw the error as shown below:

Screenshot 2023-03-01 at 12 58 56 PM
mandolyte commented 1 year ago

@larsgson here is a video that shows a couple of things that need to be addressed. Screen recording 2023-03-06 11.37.54 AM.webm

elsylambert commented 1 year ago

v0.3.0 build cf4f0aa Edits are not lost. If user closes the card without saving, a warning message appears for the respective card. User can choose to Cancel and save or continue without saving. If user reopens the same book card, edits are still present and Save button is enabled indicating that there are changes in the file that needs to be saved.

danielklapp commented 1 year ago

Tested with v0.9.0-rc.2 build 29a2450 QA. Everything looks good