diff --git a/package.json b/package.json index 1cb5c6170..cfadf771b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "bulma": "^0.7.4", "mdi": "^2.2.43", "moment": "^2.22.2", - "node-sass": "^4.9.4", + "node-sass": "^4.12.0", "qs": "^6.5.2", "react": "^16.8.3", "react-dom": "^16.8.3", diff --git a/src/classes/filter-types/checkbox/Checkbox.vue b/src/classes/filter-types/checkbox/Checkbox.vue index c22817d31..5a447972e 100644 --- a/src/classes/filter-types/checkbox/Checkbox.vue +++ b/src/classes/filter-types/checkbox/Checkbox.vue @@ -88,9 +88,7 @@ if (this.isUsingElasticSearch) { this.isLoadingOptions = false; - this.$eventBusSearch.$on('isLoadingItems', isLoading => { - this.isLoadingOptions = isLoading; - }); + this.$eventBusSearch.$on('isLoadingItems', this.updatesIsLoading); } }, props: { @@ -240,13 +238,16 @@ this.selectedValues(); } } + }, + updatesIsLoading(isLoading) { + this.isLoadingOptions = isLoading; } }, beforeDestroy() { this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags); if (this.isUsingElasticSearch) - this.$eventBusSearch.$off('isLoadingItems'); + this.$eventBusSearch.$off('isLoadingItems', this.updatesIsLoading); } } diff --git a/src/classes/filter-types/filter-types-mixin.js b/src/classes/filter-types/filter-types-mixin.js index f5f90b158..f30366fed 100644 --- a/src/classes/filter-types/filter-types-mixin.js +++ b/src/classes/filter-types/filter-types-mixin.js @@ -25,10 +25,7 @@ export const filter_type_mixin = { created() { // We listen to event, but reload event if hasFiltered is negative, as // an empty query also demands filters reloading. - this.$eventBusSearch.$on('hasFiltered', () => { - if (typeof this.loadOptions == "function") - this.loadOptions(true); - }); + this.$eventBusSearch.$on('hasFiltered', this.reloadOptionsDueToFiltering); }, mounted() { @@ -320,6 +317,10 @@ export const filter_type_mixin = { this.options[this.options.length-1].showViewAllButton = showViewAllButton; } } + }, + reloadOptionsDueToFiltering() { + if (typeof this.loadOptions == "function") + this.loadOptions(true); } }, beforeDestroy() { @@ -327,6 +328,6 @@ export const filter_type_mixin = { if (this.getOptionsValuesCancel != undefined) this.getOptionsValuesCancel.cancel('Facet search Canceled.'); - this.$eventBusSearch.$off('hasFiltered'); + this.$eventBusSearch.$off('hasFiltered', this.reloadOptionsDueToFiltering); }, }; \ No newline at end of file diff --git a/src/classes/filter-types/taxonomy/Checkbox.vue b/src/classes/filter-types/taxonomy/Checkbox.vue index 5756df31a..557b96e3b 100644 --- a/src/classes/filter-types/taxonomy/Checkbox.vue +++ b/src/classes/filter-types/taxonomy/Checkbox.vue @@ -60,11 +60,9 @@ this.loadOptions(); this.$eventBusSearch.$on('removeFromFilterTag', this.cleanSearchFromTag); - if (this.isUsingElasticSearch) { - this.$eventBusSearch.$on('isLoadingItems', isLoading => { - this.isLoading = isLoading; - }); - } + if (this.isUsingElasticSearch) + this.$eventBusSearch.$on('isLoadingItems', this.updatesIsLoading); + }, mounted(){ // We listen to event, but reload event if hasFiltered is negative, as @@ -234,7 +232,7 @@ // }); } } - + this.$eventBusSearch.$emit("sendValuesToTags", { filterId: this.filter.id, value: onlyLabels @@ -328,13 +326,16 @@ if (skipSelected == undefined || skipSelected == false) { this.selectedValues(); } + }, + updatesIsLoading(isLoading) { + this.isLoadingOptions = isLoading; } }, beforeDestroy() { this.$eventBusSearch.$off('removeFromFilterTag', this.cleanSearchFromTags); if (this.isUsingElasticSearch) - this.$eventBusSearch.$off('isLoadingItems'); + this.$eventBusSearch.$off('isLoadingItems', this.updatesIsLoading); } }