Customizer: Only POST dirty settings to preview to improve performance.
props westonruter. fixes #29983. Built from https://develop.svn.wordpress.org/trunk@29905 git-svn-id: http://core.svn.wordpress.org/trunk@29660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
1ab3190ddc
commit
4020eacd8b
|
@ -1021,10 +1021,17 @@
|
|||
nonce: api.settings.nonce,
|
||||
|
||||
query: function() {
|
||||
var dirtyCustomized = {};
|
||||
api.each( function ( value, key ) {
|
||||
if ( value._dirty ) {
|
||||
dirtyCustomized[ key ] = value();
|
||||
}
|
||||
} );
|
||||
|
||||
return {
|
||||
wp_customize: 'on',
|
||||
theme: api.settings.theme.stylesheet,
|
||||
customized: JSON.stringify( api.get() ),
|
||||
customized: JSON.stringify( dirtyCustomized ),
|
||||
nonce: this.nonce.preview
|
||||
};
|
||||
},
|
||||
|
@ -1067,6 +1074,10 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Clear setting dirty states
|
||||
api.each( function ( value ) {
|
||||
value._dirty = false;
|
||||
} );
|
||||
api.trigger( 'saved' );
|
||||
} );
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -158,6 +158,7 @@ window.wp = window.wp || {};
|
|||
initialize: function( initial, options ) {
|
||||
this._value = initial; // @todo: potentially change this to a this.set() call.
|
||||
this.callbacks = $.Callbacks();
|
||||
this._dirty = false;
|
||||
|
||||
$.extend( this, options || {} );
|
||||
|
||||
|
@ -187,6 +188,7 @@ window.wp = window.wp || {};
|
|||
return this;
|
||||
|
||||
this._value = to;
|
||||
this._dirty = true;
|
||||
|
||||
this.callbacks.fireWith( this, [ to, from ] );
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue