Make WordPress Core

Changeset 37967


Ignore:
Timestamp:
07/05/2016 02:37:06 PM (9 years ago)
Author:
ocean90
Message:

Themes: Avoid announcing the theme search results too many times.

Props afercia.
Fixes #36848.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/theme.js

    r37742 r37967  
    11041104        this.count.text( this.liveThemeCount );
    11051105
    1106         this.announceSearchResults( this.liveThemeCount );
     1106        /*
     1107         * In the theme installer the themes count is already announced
     1108         * because `announceSearchResults` is called on `query:success`.
     1109         */
     1110        if ( ! themes.isInstall ) {
     1111            this.announceSearchResults( this.liveThemeCount );
     1112        }
    11071113    },
    11081114
     
    14601466    },
    14611467
     1468    terms: '',
     1469
    14621470    // Handles Ajax request for searching through themes in public repo
    14631471    search: function( event ) {
     
    14801488    doSearch: _.debounce( function( value ) {
    14811489        var request = {};
     1490
     1491        // Don't do anything if the search terms haven't changed.
     1492        if ( this.terms === value ) {
     1493            return;
     1494        }
     1495
     1496        // Updates terms with the value passed.
     1497        this.terms = value;
    14821498
    14831499        request.search = value;
Note: See TracChangeset for help on using the changeset viewer.