#42475 closed defect (bug) (fixed)
Customize: Autosaving message not sent to preview at first change
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 4.9 | Priority: | normal |
Severity: | normal | Version: | 4.9 |
Component: | Customize | Keywords: | has-patch commit dev-reviewed |
Focuses: | Cc: |
Description (last modified by )
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. So there is somewhat of a race condition. This means that the saved
state change handler is not getting fired with the first change.
Easy way to see this behavior is to install the customizer-dev-tools plugin and run this from the console:
CustomizerDevTools.startLogging(/autosaving|saved|change/)
You'll see the autosaving
message is not sent to the preview after the first change, but it will be sent after saving a draft and making a second change.
Likewise, you can see the problem illustrated by hovering over links in the preview after the first change and see they lack the customize_autosaved=on
parameter. However, after saving a draft and making a second change, then you'll see the param appear.
Attachments (1)
Change History (7)
#2
@
7 years ago
I was able to reproduce the behavior and observe that the patch corrects it. The change looks good to me.
#4
@
7 years ago
- Keywords dev-reviewed added; dev-feedback removed
I was confused by the reported issue at first, but the customizer-dev-tools plugin was super useful.
42475.diff looks good. +1 for commit.
The solution is simply to call handler for
saved
state change whenstartAutosaving
is being called. See 42475.diff.