Themes: Avoid announcing the theme search results too many times.
Props afercia. Fixes #36848. Built from https://develop.svn.wordpress.org/trunk@37967 git-svn-id: http://core.svn.wordpress.org/trunk@37908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
de3b2db1e2
commit
bcf027eda1
|
@ -1103,7 +1103,13 @@ themes.view.Themes = wp.Backbone.View.extend({
|
|||
this.liveThemeCount = this.collection.count ? this.collection.count : this.collection.length;
|
||||
this.count.text( this.liveThemeCount );
|
||||
|
||||
this.announceSearchResults( this.liveThemeCount );
|
||||
/*
|
||||
* In the theme installer the themes count is already announced
|
||||
* because `announceSearchResults` is called on `query:success`.
|
||||
*/
|
||||
if ( ! themes.isInstall ) {
|
||||
this.announceSearchResults( this.liveThemeCount );
|
||||
}
|
||||
},
|
||||
|
||||
// Iterates through each instance of the collection
|
||||
|
@ -1459,6 +1465,8 @@ themes.view.InstallerSearch = themes.view.Search.extend({
|
|||
'keyup': 'search'
|
||||
},
|
||||
|
||||
terms: '',
|
||||
|
||||
// Handles Ajax request for searching through themes in public repo
|
||||
search: function( event ) {
|
||||
|
||||
|
@ -1480,6 +1488,14 @@ themes.view.InstallerSearch = themes.view.Search.extend({
|
|||
doSearch: _.debounce( function( value ) {
|
||||
var request = {};
|
||||
|
||||
// Don't do anything if the search terms haven't changed.
|
||||
if ( this.terms === value ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Updates terms with the value passed.
|
||||
this.terms = value;
|
||||
|
||||
request.search = value;
|
||||
|
||||
// Intercept an [author] search.
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.6-beta1-37966';
|
||||
$wp_version = '4.6-beta1-37967';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue