mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-13 02:51:33 +01:00
Customize: Prevent infinite full refresh from occurring when selective refresh falls back for a nav menu that has items excluded from rendering via filtering.
See #37032. Fixes #38612. Built from https://develop.svn.wordpress.org/trunk@39510 git-svn-id: http://core.svn.wordpress.org/trunk@39450 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a5dbd53a46
commit
672b8a61cd
@ -15,7 +15,19 @@ wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function(
|
|||||||
* Initialize nav menus preview.
|
* Initialize nav menus preview.
|
||||||
*/
|
*/
|
||||||
self.init = function() {
|
self.init = function() {
|
||||||
var self = this;
|
var self = this, synced = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Keep track of whether we synced to determine whether or not bindSettingListener
|
||||||
|
* should also initially fire the listener. This initial firing needs to wait until
|
||||||
|
* after all of the settings have been synced from the pane in order to prevent
|
||||||
|
* an infinite selective fallback-refresh. Note that this sync handler will be
|
||||||
|
* added after the sync handler in customize-preview.js, so it will be triggered
|
||||||
|
* after all of the settings are added.
|
||||||
|
*/
|
||||||
|
api.preview.bind( 'sync', function() {
|
||||||
|
synced = true;
|
||||||
|
} );
|
||||||
|
|
||||||
if ( api.selectiveRefresh ) {
|
if ( api.selectiveRefresh ) {
|
||||||
// Listen for changes to settings related to nav menus.
|
// Listen for changes to settings related to nav menus.
|
||||||
@ -32,7 +44,7 @@ wp.customize.navMenusPreview = wp.customize.MenusCustomizerPreview = ( function(
|
|||||||
* this can trigger an infinite fallback refresh when the nav menu item lacks any valid items.
|
* this can trigger an infinite fallback refresh when the nav menu item lacks any valid items.
|
||||||
*/
|
*/
|
||||||
if ( setting.get() && ! setting.get()._invalid ) {
|
if ( setting.get() && ! setting.get()._invalid ) {
|
||||||
self.bindSettingListener( setting, { fire: true } );
|
self.bindSettingListener( setting, { fire: synced } );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
api.bind( 'remove', function( setting ) {
|
api.bind( 'remove', function( setting ) {
|
||||||
|
File diff suppressed because one or more lines are too long
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.8-alpha-39508';
|
$wp_version = '4.8-alpha-39510';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user