Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosave stops working when typing fast #2349

Closed
mchowning opened this issue Jun 4, 2020 · 8 comments · Fixed by #2353
Closed

Autosave stops working when typing fast #2349

mchowning opened this issue Jun 4, 2020 · 8 comments · Fixed by #2353
Assignees
Labels
[Pri] Critical [Type] Bug Something isn't working

Comments

@mchowning
Copy link
Contributor

Describe the bug
When quickly entering text into a block (paragraph, verse, etc.), the autosave mechanism stops working. As a result, immediately publishing a post after quickly entering the text results in the loss of most of the text that was quickly typed. This issue only seems to be reproducible on Android for some reason.

To Reproduce
Steps to reproduce the behavior:

  1. Open a new post with an empty paragraph block
  2. Quickly type 30+ characters (i.e., tap "A" a bunch of times in a row)
  3. Publish the post (without selecting or changing any other blocks)
  4. Observe that the published post only has the first ~5 "A" letters

Expected behavior
All content should be saved.

content-loss

Smartphone (please complete the following information):

  • Device: Pixel 1
  • OS: Android X
  • Version: 15.0-rc1

Additional context
h/t to @guarani and @malinajirka for identifying this issue. 🙇
Related discussion in Slack starting here: p1591281221117400-slack-mobile-gutenberg

@mchowning mchowning added [Type] Bug Something isn't working [Pri] Critical labels Jun 4, 2020
@mchowning
Copy link
Contributor Author

It looks to me like this issue was introduced with #2285. @dratwas, do you think we can just revert that PR for the 15.0 release of the main apps, or will that lead to side effects (or maybe there's a better fix)? cc: @mkevins , @chipsnyder

@dratwas
Copy link
Contributor

dratwas commented Jun 5, 2020

Hey, @mchowning I created a PR where i revert these changes WordPress/gutenberg#22933 . W can simply revert them since the slider PR WordPress/gutenberg#22421 is not merged yet.

@mchowning
Copy link
Contributor Author

mchowning commented Jun 5, 2020

Went back and looked at the bisect again and I’m seeing similar results, but it’s a bit more complicated than I originally realized.

On the commit for the transient edit changes (9ecd115), if I enter a bunch of characters in rapid succession, the post is saved once at the very beginning and it never saves again as long as I keep entering characters quickly. I can even let the editor sit after quickly entering the characters, and it never saves most of the characters unless I start typing again.

On the commit before the transiet edit changes (9ecd115~1 or b193c71) even if I enter the characters quickly the saving happens, but the saving seems like it is a bit delayed. So if I enter a bunch of characters quickly and then immediately publish the post, the last 10-20 characters are lost. If I wait ~5 seconds after entering the characters quickly though, all the content gets saved. This is on a debug build with the bundler attached, so it's probably slower than a release build would be. (update below)

@mchowning
Copy link
Contributor Author

if I enter a bunch of characters quickly and then immediately publish the post, the last 10-20 characters are lost. If I wait ~5 seconds after entering the characters quickly though, all the content gets saved. This is on a debug build with the bundler attached, so it's probably slower than a release build would be.

Tested a 14.9 release build on a physical Pixel 1 and I was not able to recreate the delayed save losing content issue. Would be good to test this on a very slow device though.

The fact that Android doesn't get the latest post content before publishing is still a problem even though this is not a new issue and seems like it probably does not need an immediate hotfix. This explains why this issue was only observable on iOS since iOS always retrieves the full post HTML before publishing whereas it appears that Android only publishes what has already been saved. Let's leave this issue open until we update Android to also retrieve the full HTML content before saving.

@dratwas
Copy link
Contributor

dratwas commented Jun 5, 2020

In addition to @mchowning comment. I'm able to reproduce the issue with the delay on release build but on the emulator, so I think it could be still an issue on low-end Android devices. The gif below present that behavior:
bug

@mchowning
Copy link
Contributor Author

Reopening this because we still need to address Android's failure to retrieve the latest HTML content before publishing.

@mchowning
Copy link
Contributor Author

mchowning commented Jun 29, 2020

Quick update on this. There were some concerns about adding the save-on-exit functionality on Android initially, but there is agreement on a path forward for adding it now. I worked on implementing that last week, but it’s not done yet. With me being on groundskeeping this week (and it being a short week with the team AFK) I probably won’t get back to it until next week.

Also, even with the Android save-on-exit fix, we should still make sure that when we merge the selectionStart and selectionEnd changes, we still address the issue it introduced where change notifications were not sent to the main apps when a user typed quickly, since that prevents the autosave functionality from working on both platforms. The good thing is that addressing the not sending change events to the main apps would mean that Android adding the save-on-exit change is no longer a blocker, although it still needs to be done (and I am working on it).

cc: @pinarol

@mchowning
Copy link
Contributor Author

mchowning commented Aug 25, 2020

The PR for Android to always save the post when exiting the editor has been merged, so I believe that wraps up all the work associated needed for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Pri] Critical [Type] Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants