Skip to content

Renew nonce to prevent expiration and Updating failed message #9260

@iandunn

Description

@iandunn

Describe the bug

I often will keep a tab open in the editor for hours, days, or weeks, while working on a post. I'll make some edits, then mull things over while doing something else, then come back to jot some some ideas or refine something.

While doing that with Gutenberg, I've often noticed that, when I come back and start typing, I'll see an Updating failed error. If I had to guess, I'd say that that the nonce used in the save draft API request has expired, so the request fails.

If that's the case, then I think that Gutenberg should automatically renew the nonce to prevent this from happening. IIRC, Core already does this with the Heartbeat API or something similar.

Related Issues

#9146, #8241, and #4590 are related, but seem like a different underlying cause, because in those cases the error seems to happens on every save attempt (often caused by CloudFlare blocking the API request), whereas here the API requests work normally at first, and then start to fail only after a period of time has past.

IIRC, I've experienced this both in production environments behind CloudFlare, and also in my local development environment.

To Reproduce

  1. Draft a post
  2. Leave it sitting for 12+ hours. It may be possible to artificially reproduce the conditions by changing NONCE_KEY or something similar.
  3. Come back to the editor and start typing. You should get an Updating failed error.

Screenshots

screen shot 2018-08-22 at 8 00 20 pm

Desktop (please complete the following information):

  • OS X 10.13.6
  • Firefox Developer Edition 62.0b15 (64-bit)
  • Gutenberg 3.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    REST API InteractionRelated to REST API[Feature] SavingRelated to saving functionality[Priority] HighUsed to indicate top priority items that need quick attention[Type] BugAn existing feature does not function as intended

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions