Customize: Debounce requests for theme searches and the updating of the resulting filter count.

Props celloexpressions.
See #37661.
Fixes #42343.

Built from https://develop.svn.wordpress.org/trunk@42040


git-svn-id: http://core.svn.wordpress.org/trunk@41874 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-10-30 03:57:52 +00:00
parent 9a18c87e0c
commit fbb0b8bc8f
3 changed files with 9 additions and 8 deletions

View File

@ -1680,6 +1680,7 @@
nextTags: '', nextTags: '',
filtersHeight: 0, filtersHeight: 0,
headerContainer: null, headerContainer: null,
updateCountDebounced: null,
/** /**
* Initialize. * Initialize.
@ -1696,6 +1697,7 @@
section.$window = $( window ); section.$window = $( window );
section.$body = $( document.body ); section.$body = $( document.body );
api.Section.prototype.initialize.call( section, id, options ); api.Section.prototype.initialize.call( section, id, options );
section.updateCountDebounced = _.debounce( section.updateCount, 500 );
}, },
/** /**
@ -1869,7 +1871,6 @@
if ( ! section.expanded() ) { if ( ! section.expanded() ) {
section.expand(); section.expand();
} }
section.checkTerm( section );
}); });
// Feature filters. // Feature filters.
@ -2240,7 +2241,7 @@
api.reflowPaneContents(); api.reflowPaneContents();
// Update theme count. // Update theme count.
section.updateCount( count ); section.updateCountDebounced( count );
}, },
/** /**
@ -2255,7 +2256,7 @@
var newTerm; var newTerm;
if ( 'remote' === section.params.filter_type ) { if ( 'remote' === section.params.filter_type ) {
newTerm = section.contentContainer.find( '.wp-filter-search' ).val(); newTerm = section.contentContainer.find( '.wp-filter-search' ).val();
if ( section.term !== newTerm ) { if ( section.term !== newTerm.trim() ) {
section.initializeNewQuery( newTerm, section.tags ); section.initializeNewQuery( newTerm, section.tags );
} }
} }

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta4-42039'; $wp_version = '4.9-beta4-42040';
/** /**
* 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.