[wp-trac] [WordPress Trac] #54708: Retain existing autosave when new autosave is the same

WordPress Trac noreply at wordpress.org
Wed Dec 29 18:09:49 UTC 2021


#54708: Retain existing autosave when new autosave is the same
-----------------------------+------------------------------
 Reporter:  adamsilverstein  |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  General          |     Version:
 Severity:  normal           |  Resolution:
 Keywords:                   |     Focuses:
-----------------------------+------------------------------
Changes (by adamsilverstein):

 * keywords:  has-patch =>


Comment:

 I found several users reporting related bugs on trac: #49532, #52933


 I tracked down the source of why we chose to delete this autosave in the
 endpoint: https://core.trac.wordpress.org/ticket/43316#comment:62 --

 "if the post content is identical to the new content that is being auto-
 saved, the previous autosave revision is deleted to prevent having a
 redundant revision (i.e. if the update of the previous autosaved revision
 will make it identical to the current post, there is no need of it)."

 This makes sense, except that because we return an error, a new autosave
 is never created. So the post now lacks and autosave, and this later
 causes `_set_preview` to [https://github.com/WordPress/wordpress-
 develop/blob/c5f9e9abeaf115d34834d94da3cf10f1fbd2077d/src/wp-
 includes/revision.php#L642 bail early], breaking preview functionality.

 I would propose that since the autosave already exists with the correct
 data, we should leave it in place so previews continue working as
 expected. We can clean it up later, when the post is published for
 example.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54708#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list