Fix search being canceled when filters emptied

Only reset the lastSearch and lastCombinedFilter variables if the filters were equal before. We don't need to "force filter refresh" if the filters were not equal anyways.
This commit is contained in:
larsbonczek 2019-05-10 20:55:16 +02:00 committed by Rob Garrison
parent c2532c69a9
commit 20d87d933e

View File

@ -1363,12 +1363,14 @@
} }
// return if the last search is the same; but filter === false when updating the search // return if the last search is the same; but filter === false when updating the search
// see example-widget-filter.html filter toggle buttons // see example-widget-filter.html filter toggle buttons
if ( tsf.equalFilters(c, c.lastSearch, currentFilters) && filter !== false ) { if ( tsf.equalFilters(c, c.lastSearch, currentFilters) ) {
return; if ( filter !== false ) {
} else if ( filter === false ) { return;
// force filter refresh } else {
c.lastCombinedFilter = ''; // force filter refresh
c.lastSearch = []; c.lastCombinedFilter = '';
c.lastSearch = [];
}
} }
// define filter inside it is false // define filter inside it is false
filters = filters || []; filters = filters || [];