From 89dbe8dc72dfe52ff2415befdb8f1ebf96172f2e Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Fri, 27 Nov 2020 14:25:49 +0800 Subject: [PATCH] Fix duplicate AJAX call on using Apply or Clear buttons in group filter Fixes https://github.com/octobercms/october/issues/5365 --- modules/system/assets/ui/js/filter.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/system/assets/ui/js/filter.js b/modules/system/assets/ui/js/filter.js index 8c9563365..3f260bc51 100644 --- a/modules/system/assets/ui/js/filter.js +++ b/modules/system/assets/ui/js/filter.js @@ -156,7 +156,7 @@ $(event.relatedTarget).on('input', '#controlFilterPopover input[data-search]', function (e) { self.searchQuery($(this)) - }); + }) }) // Setup event handler to apply selected options when closing the type: group scope popup @@ -176,7 +176,7 @@ */ FilterWidget.prototype.bindDependants = function() { if (!$('[data-scope-depends]', this.$el).length) { - return; + return } var self = this, @@ -399,8 +399,8 @@ if (!data.active) data.active = [] if (!data.available) data.available = [] - this.scopeValues[scopeName] = data.active; - this.scopeAvailable[scopeName] = data.available; + this.scopeValues[scopeName] = data.active + this.scopeAvailable[scopeName] = data.available // Do not render if scope has changed if (scopeName != this.activeScopeName) @@ -552,11 +552,12 @@ if (isReset) { this.scopeValues[scopeName] = null this.scopeAvailable[scopeName] = null + this.isActiveScopeDirty = true this.updateScopeSetting(this.$activeScope, 0) } - this.pushOptions(scopeName); - this.isActiveScopeDirty = true; + this.pushOptions(scopeName) + this.isActiveScopeDirty = false this.$activeScope.data('oc.popover').hide() }