Skip to content

RTC: Autosaves on a collaborative document often result in "more recent" autosave warning #80077

Description

@alecgeatches

When content has been modified in a post after saving, the "There is an autosave of this post that is more recent than the version below" notice appears for all users:

Image

Reproduction

  1. Join a post with two users in RTC.
  2. Add content and save.
  3. After saving, add more content but do not save.
  4. Wait for any user's /autosave request to fire.
  5. Refresh the page or load the post in another tab. See the "There is an autosave of this post that is more recent than the version below" notice:
newer-autosave-repro.mov

As you can see in the reproduction above, users are warned that there's more recent content available in an autosave, but when they click into the revision, the content is the same as what's shown on the post. It's confusing.

Cause

In RTC, all user autosaves target a revision and not the actual parent post. This was done to avoid having inconsistent save behavior between the original post author and other peers in a collaborative session. After an autosave fires, WordPress detects that the latest autosave is newer than the parent post and sets an autosave flag on load. Gutenberg reads the flag and shows the more recent autosave notice. Because we're always targeting a revision until a real save happens, the autosave warning is always triggered.

It's true that the content hasn't been persisted to the parent post, which is in the spirit of the warning, but it is confusing to see the same content in an autosave as the loaded post data from the server. The notice is also annoying to always see when entering an in-progress document. We should reconsider the logic we use in RTC when we're showing it.

See related discussion in #79911 (comment) and bug #79591, which addressed blank revisions but do not fix the notice problem directly.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions