From 44d90537cdb0c1e3f6991a3e41d64cd9955aa942 Mon Sep 17 00:00:00 2001 From: larsbonczek <44197504+larsbonczek@users.noreply.github.com> Date: Fri, 10 May 2019 21:11:14 +0200 Subject: [PATCH] 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. --- js/widgets/widget-filter.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/js/widgets/widget-filter.js b/js/widgets/widget-filter.js index 99a85150..96dfa5fb 100644 --- a/js/widgets/widget-filter.js +++ b/js/widgets/widget-filter.js @@ -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 || [];