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 21:11:14 +02:00 committed by Rob Garrison
parent 20d87d933e
commit 44d90537cd

View File

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