[wp-trac] [WordPress Trac] #42502: Customize: Autosave revision not dismissed after first change

WordPress Trac noreply at wordpress.org
Fri Nov 10 08:54:02 UTC 2017


#42502: Customize: Autosave revision not dismissed after first change
--------------------------+-----------------
 Reporter:  westonruter   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  4.9
Component:  Customize     |    Version:  4.9
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------
 After having saved a draft of a changeset, any changes you make after this
 will get stored in an autosave revision for that changeset. If you reload
 the Customizer without saving the changeset again, then when the
 Customizer is loaded a notification will appear for whether or not to
 restore the autosave revision. If the user clicks the dismiss button, then
 an Ajax request is opened to dismiss the autosave to prevent it from being
 prompted again and the notification is removed. Additionally, the
 notification is removed if any change is subsequently made, //but// the
 autosave revision dismissal request is not opened in this case.

 See code here: https://github.com/WordPress/wordpress-
 develop/blob/58fad5b/src/wp-admin/js/customize-controls.js#L8297-L8344

 The lack of autosave revision dismissal at the point where a `change`
 happens has a negative consequence: an Ajax request in the preview will
 include the `customize_autosaved` parameter (since the `autosaving`
 message was received, see #42475) but since the autosave revision hasn't
 been dismissed then it will get loaded in the request, and cause a
 mismatch between the changeset state in the user's browser and the
 changeset data that is used for previewing.

 The easiest way to replicate the problem is:

 1. Add 5 nav menu items
 2. Save draft
 3. Put the last item as the first and the first item as the last.
 4. Reload, giving a second before confirming to give autosave a chance.
 5. Notice the autosave notification.
 6. Move the second nav menu item after the third nav menu item.
 7. Notice the autosave notification go away.
 8. BUG: Notice that even though you only moved the second nav menu item
 after the third, the first and last nav menu items _also_ switched places.
 This is because the autosave revision was incorrectly restored since it
 hasn't been dismissed yet.

 Video: https://youtu.be/dnu8Lw8Pr14

 The immediate fix is just to make sure the revision dismissal request
 happens both when dismissing the notification explicitly and when
 dismissal happens implicitly as result changing an item.

 In 4.9.1 I'd like to revisit the autosaving logic to harden how the
 autosaved state is passed around.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42502>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list