wordpress-mobile / WordPress-Android

WordPress for Android
http://android.wordpress.org
GNU General Public License v2.0
2.97k stars 1.32k forks source link

Run remote-auto-save periodically in Editor #10398

Open malinajirka opened 5 years ago

malinajirka commented 5 years ago

We periodically auto-save a post which is being edited into the local storage. However, several users experienced a very unpleasant bug in the app which resulted in content loss.

I think we might want to consider running remote-auto-save periodically when the user is in the editor. We can't run it every 10 seconds as we'd be wasting a lot of users' data. But saving the content every 2-5 minutes might be reasonable. We could take it one step further and perform the remote-auto-save only when the post's content was significantly changed.

malinajirka commented 4 years ago

We disabled remote-auto-saving while the editor is opened as the request may take some time and the user can edit the post within that time. Imagine the following scenario:

  1. Post content is "A"
  2. Remote-Auto-Save is invoked
  3. User edits the content to "Abcdefg"
  4. Remote-Auto-Save request completes and we emit PostUpdated event with content "A"
  5. The EditPostActivity handles that event and "Abcdefg" content gets overridden with "A"

I still think this issue is feasible, but we need to keep this scenario in mind.