Make WordPress Core

Changeset 42040


Ignore:
Timestamp:
10/30/2017 03:56:26 AM (7 years ago)
Author:
westonruter
Message:

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

Props celloexpressions.
See #37661.
Fixes #42343.

File:
1 edited

Legend:

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

    r42038 r42040  
    16811681        filtersHeight: 0,
    16821682        headerContainer: null,
     1683        updateCountDebounced: null,
    16831684
    16841685        /**
     
    16971698            section.$body = $( document.body );
    16981699            api.Section.prototype.initialize.call( section, id, options );
     1700            section.updateCountDebounced = _.debounce( section.updateCount, 500 );
    16991701        },
    17001702
     
    18701872                        section.expand();
    18711873                    }
    1872                     section.checkTerm( section );
    18731874                });
    18741875
     
    22412242
    22422243            // Update theme count.
    2243             section.updateCount( count );
     2244            section.updateCountDebounced( count );
    22442245        },
    22452246
     
    22562257            if ( 'remote' === section.params.filter_type ) {
    22572258                newTerm = section.contentContainer.find( '.wp-filter-search' ).val();
    2258                 if ( section.term !== newTerm ) {
     2259                if ( section.term !== newTerm.trim() ) {
    22592260                    section.initializeNewQuery( newTerm, section.tags );
    22602261                }
Note: See TracChangeset for help on using the changeset viewer.