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,12 +962,14 @@
}
// 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 ) {
return;
} else if ( filter === false ) {
// force filter refresh
c.lastCombinedFilter = '';
c.lastSearch = [];
if ( tsf.equalFilters(c, c.lastSearch, currentFilters) ) {
if ( filter !== false ) {
return;
} else {
// force filter refresh
c.lastCombinedFilter = '';
c.lastSearch = [];
}
}
// define filter inside it is false
filters = filters || [];