[wp-trac] [WordPress Trac] #27355: Customizer: Add framework for selective refresh (partial preview refreshes)
WordPress Trac
noreply at wordpress.org
Fri Feb 19 01:34:38 UTC 2016
#27355: Customizer: Add framework for selective refresh (partial preview refreshes)
--------------------------------------+--------------------------
Reporter: westonruter | Owner: westonruter
Type: task (blessed) | Status: reviewing
Priority: normal | Milestone: 4.5
Component: Customize | Version: 3.4
Severity: normal | Resolution:
Keywords: has-patch has-unit-tests | Focuses: javascript
--------------------------------------+--------------------------
Comment (by westonruter):
Replying to [comment:72 ocean90]:
> * Widgets: When adding a widget to an empty sidebar I get a JS error:
I've seen this before as well in certain situations but didn't patch it
yet. The issue can be easily reproduced even without selective refresh by
adding a button in the preview which does:
{{{#!js
wp.customize.preview.send( 'refresh' );
wp.customize.preview.send( 'refresh' );
}}}
This will also trigger the error.
I've filed a ticket for this and patched it in #35866.
The alternative fix, to address the symptom instead of the underlying
cause, is to debounce the `requestFullRefresh` function:
{{{#!js
--- src/wp-includes/js/customize-selective-refresh.js
+++ src/wp-includes/js/customize-selective-refresh.js
@@ -507,9 +507,9 @@ wp.customize.selectiveRefresh = ( function( $, api ) {
*
* @since 4.5.0
*/
- self.requestFullRefresh = function() {
+ self.requestFullRefresh = _.debounce( function() {
api.preview.send( 'refresh' );
- };
+ } );
/**
* Request a re-rendering of a partial.
}}}
But better to fix the underlying issue instead.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27355#comment:76>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list