gutenberg-mobile icon indicating copy to clipboard operation
gutenberg-mobile copied to clipboard

Post updates lost when exiting very long post - WPAndroid

Open cameronvoell opened this issue 4 years ago • 5 comments

Describe the bug When editing a very large post, it is possible to edit the post, exit the editor, and have recent edits not be saved to the post as expected.

To Reproduce Steps to reproduce the behavior:

  1. Load a large post in the editor. Example: https://upm59krakatit.wordpress.com/2021/02/08/long-post/
  2. Edit the title
  3. Wait 5 seconds
  4. Exit editor
  5. Notice changes are not shown in the post list

Expected behavior Exiting the post should always save the latest changes in the post.

Screenshots If applicable, add screenshots to help explain your problem. save-problem-long-post

Smartphone (please complete the following information):

  • Device: Galaxy S10+
  • OS: [e.g. iOS 8.1, Android X] Android 11

Additional context Add any other context about the problem here.

cameronvoell avatar Feb 18 '21 20:02 cameronvoell

Thanks for investigating this and figuring out the steps to reproduce @cameronvoell ! 🙇

How consistently does this bug occur?

Based on the gif, it looks like the "fallback save" is being triggered when you exit the editor, but it is not actually saving the latest content for some reason. Is that your understanding?

Steps to reproduce the behavior: ... 3. Wait 5 seconds

Does this mean that the bug only occurs if you wait 5 seconds 😱 , or is there a different reason for including that step?

mchowning avatar Feb 18 '21 22:02 mchowning

How consistently does this bug occur? Based on the gif, it looks like the "fallback save" is being triggered when you exit the editor, but it is not actually saving the latest content for some reason. Is that your understanding?

From my testing so far, it looks like likelihood of save failure is a factor of post length, device performance, and how long you wait after the last edit. I'll add a comment here with some more data points to help us figure out how common this bug is.

Does this mean that the bug only occurs if you wait 5 seconds 😱 , or is there a different reason for including that step?

I added the 5 second wait to show that this should not be affected by autosaves that would be pending because of the 1/2 second WPAndroid save debouncer.

cameronvoell avatar Feb 19 '21 17:02 cameronvoell

I'll mark this as a high priority now because it involves data loss. It might be enough of an edge case though that it can be treated as a medium. Basically, I don't feel super-strongly.

mchowning avatar Feb 23 '21 23:02 mchowning

Noting that the steps in the description seem to reproducible just about 100% of the time on my Samsung Galaxy S10 running Android 11 with this 97k word post

If I drop down to a 24k word post, I was able to get it maybe 1/5 times, and never got it in a post with less words than that.

When I tried testing on my Pixel 3 emulator running API 28, I could get it to occur with the 24k words post fairly easily, about 1/2 times.

Also noting that most times when this issue occur we also send the event in Sentry detailed in this issue: https://github.com/wordpress-mobile/WordPress-Android/issues/13003

cameronvoell avatar Feb 25 '21 08:02 cameronvoell

I tested using the 97k sample post from this comment and am still able to replicate the original steps towards content loss.

Noting that ~November 2021, some updates were made to improve saving/syncing on Android, in https://github.com/WordPress/gutenberg/pull/36072, https://github.com/wordpress-mobile/WordPress-Android/pull/15509, and pb3aDo-18j-p2. Following that work, the Sentry tracking event we had in https://github.com/wordpress-mobile/WordPress-Android/issues/13003 was removed.

I'm leaving the [Pri] High label, as this issue is leading to content loss, but acknowledge we'd likely need help from an Android developer to fix this. It also may be related to ongoing issues we have with long posts in general.

SiobhyB avatar Jan 08 '24 16:01 SiobhyB