UPDATE_COLLISION can causes work loss, AKA "Someone else is editing this post"

Issue Summary

If the same post is open in two different sessions, one session will experience the an error “Someone else is editing this post” when attempting to save. The state is currently not recoverable. Any changes can’t be saved. To preserve your work, it all needs to be copied to another location-- a potentially tedious process with a multiple block types are used-- then the other version can be loaded and the edits re-applied.

That work is unavoidable if the two edits truly conflict, but it’s a tragic error to run into if edits you are trying save the ones you know should “win” and it’s other edits should be discarded.

Steps to Reproduce

  1. Start editing a post.
  2. Open a second browser, start editing the same post. Make sure your work gets saved and close the browser.
  3. Attempt to save your work in the first browser.

In the real world, this kind of situation might happen if:

  • Two journalists are attempting to both edit breaking news at the same time.
  • You start an edit on mobile, but then open the the same post on the desktop.

Proposed Fix: Let the user choose the conflict resolution.

Don’t assume that the first session to save the document should “win” the edit conflict. Put the blog editors in the driver’s seat to decide how to resolve it. Instead of an error message, have a warning message and a choice:

Warning! The user “Susie Smith” has saved changes to this document since you started to edit to it. If you save your changes, their changes will be lost! Proceed anyway?

In my recent case, allowing the session receiving the error message to “win” the edit conflict was definitely the right choice. I documented here the awkward, technical workaround for this:

Proposed Fix: Warn in advance

Especially since there’s no conflict resolution or real-time collaborative editing, it would be valuable to warn editors in advance before they have an edit conflict. This can be done with a warning at the point a document is being opened:

Warning! This post was recently opened for editing in another session by Susie Smith. If you also open the document, your edits may conflict with theirs. To be safe, this post should be closed in other sessions before it’s opened here. Do you want to open the document anyway?


Setup information

Ghost Version

5.2.3

Database type
MySQL

Relevant log / error output

Saving failed! Someone else is editing this post.
Error ID:
    be04cbd0-ef45-11ec-8481-fb353dccfee3
Error Code: 
    UPDATE_COLLISION
Details:
    clientUpdatedAt: 2022-06-18T19:22:57.000Z
    serverUpdatedAt: 2022-06-18T19:32:54.000Z
----------------------------------------
UpdateCollisionError: Saving failed! Someone else is editing this post.
    at Sync.update (/sites/example.com/versions/5.2.3/node_modules/@tryghost/bookshelf-collision/lib/bookshelf-collision.js:62:31)