Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #42475


Ignore:
Timestamp:
11/08/2017 08:23:10 PM (7 years ago)
Author:
westonruter
Comment:

The solution is simply to call handler for saved state change when startAutosaving is being called. See 42475.diff.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #42475

    • Property Keywords has-patch needs-testing added
  • Ticket #42475 – Description

    initial v1  
    1 In `customize-controls.js` there is a `startAutosaving` function that gets called once a change is first made. It then in turn will start listening for changes to the `saved` state to then send an `autosaving` message to the preview when it goes dirty. However, the `saved` state also gets set to `false` (dirty) when a `change` event happens. This means that the `saved` state change handler is not getting fired with the first change.
     1In `customize-controls.js` there is a `startAutosaving` function that gets called once a change is first made. It then in turn will start listening for changes to the `saved` state to then send an `autosaving` message to the preview when it goes dirty. However, the `saved` state also gets set to `false` (dirty) when a `change` event happens. So there is somewhat of a race condition. This means that the `saved` state change handler is not getting fired with the first change.
    22
    33Easy way to see this behavior is to install the customizer-dev-tools plugin and run this from the console: