Wp-calypso: Gutenberg crashes on user action when offline

Created on 7 Mar 2019  路  5Comments  路  Source: Automattic/wp-calypso

Steps to reproduce

  1. Starting at URL: https://wordpress.com/block-editor/post/ or https://{subdomain}.wordpress.com/wp-admin/post-new.php
  2. In the inspector, find the "Network" tab and check the "Offline" mode.
  3. Start writing you post, then hit "Save Draft".
  4. Witness the crash notice.

What I expected

I expected the red error notice that appears if you follow the above steps and wait for autosave to kick in rather than you hitting "Save Draft".

screen shot 2019-03-06 at 3 07 18 pm

What happened instead

I received a message about an unknown error occurring.

image

Browser / OS version

Google Chrome 72.0.3626.121, macOS 10.14.3

[Goal] Gutenberg [Type] Bug

All 5 comments

I had a user report a possibly-related instance of this today in #13593601-hc

They're seeing "Saving of Draft Failed" from time to time when trying to update posts.

These are the conditions they relayed to me:

  • They leave their computer for a while and the screen goes off after 15 minutes
  • They have their computer to set never to sleep
  • They return to the page/post later and make edits, then try to save, but sometimes they get the error message

This happens intermittently鈥攏ot predictably reproducible by them.

I suspect it may be related to a dropped network connection or that the connection to the server gets lost.

Offline support within Calypso/WordPress.com does not have the same behavior as core Block Editor.

If you start a post on WordPress.com, either through Calypso or /wp-admin/ and you lose network after starting the post, no indication is given that you have lost network. If you continue to Publish and then navigate away, you will lose any data entered since last save, but if you lost network you may not know when that was.

Test:

  1. Start a post in block editor
  2. Turn off your network
  3. Click Publish
  4. Click View Post after "Published"
  5. You'll get a page not found, since you don't have network and changes are lost

In core, if you click publish with no network in WordPress 5.3

Screenshot from 2019-12-18 14-54-38

In core, if you click publish with no network in Gutenberg v7.1 plugin

Screenshot from 2019-12-18 14-57-38

API middleware handling likely needs to be updated. (We modify this internally to translate relative site requests to public.api requests). Detection handling in core happens here:

https://github.com/WordPress/gutenberg/blob/9c660bf17d21e29df2e5d1d7b5ef7cc256fe04bb/packages/api-fetch/src/index.js#L98

Might be worth updating https://github.com/Automattic/wp-calypso/issues/29909 at the same time

Might be worth updating #29909 at the same time

Agree! D37093-code (~currently in progress~ ready to review) should help with both #29909 and this one

Done in D37093-code

Was this page helpful?
0 / 5 - 0 ratings