Customize: Debounce requests for theme searches and the updating of the resulting filter count.
Props celloexpressions. See #37661. Fixes #42343. git-svn-id: https://develop.svn.wordpress.org/trunk@42040 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
8f0dbb4f43
commit
9461f57532
@ -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 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user