ecency / ecency-mobile

Ecency Mobile - reimagined social blogging, contribute and get rewarded (for Android and iOS)
https://ecency.com
MIT License
233 stars 69 forks source link

locally saved drafts getting cleard #1877

Closed noumantahir closed 3 years ago

noumantahir commented 3 years ago

Nina (the user) she usually has issues with draft for some reason, draft save doesn't work for her, or she writes some text and goes to other screens and comes back and her draft is gone, etc. We should really check this draft flow. I know we save drafts to localstorage and backend as well, so there is combination when user is offline etc. cases, overall check on flow would be really good.

Grrr! Updated to the new version of Ecency and found out the hard way the save draft button did not save all my work after over two hours inputting. Samsung Galaxy Note8 smartphone user.

Steps to reproduce the behavior:

  1. Go to editor
  2. Add some body, save draft
  3. Go to any post, create and remove a replay draft
  4. post draft gets cleared

Expected behavior draft should only be cleared either on post publishing or user clear action

noumantahir commented 3 years ago

Initial debugging reveal two issues with editorConainer, one may be an issue

  1. using UNSAFE method Screenshot 2021-03-24 at 1 58 14 PM

  2. draft getting cleared when reply body text is set to '' Screenshot 2021-03-24 at 2 05 49 PM

  3. draft saved to db never being retrieved at all in markdownEditor, @feruzm please let me know if this is a bug or an expected behaviour, there is a draftsScreen but I am not sure how users access it in app.

noumantahir commented 3 years ago

This snippet inside save current draft cancel draft saving to local storage if user is editing a draft saved on backend.

Screenshot 2021-03-24 at 7 51 20 PM

It seems as if it is placed on purpose which I do not understand yet but the problem is, if the user was indeed editing a pre-saved draft and exists the editor without tapping the save button... there will be no record of those edits anywhere, neither on phone nor in the backend.

And this could possibly be what nina have been experiencing. there are 2 possibilities for her...

she opened the editor from one of draft, edited it, closed the editor without saving to DB again,

  1. came back to editor using 'pencil' bottom tab, and nothing was there
  2. she opened the editor from drafts again expecting it to have the updated already, but only saw the old version of it.

According to her description, it seem 1. could possibly be her issue.

@feruzm suggest an expected flow for this