Fixes filter type mixin deregistering global hasFiltered boolean on items page. This prevented some tags to appear.

This commit is contained in:
Mateus Machado Luna 2019-05-14 17:46:21 -03:00
parent 27c4a66dfc
commit 39140fd39d
4 changed files with 20 additions and 17 deletions

View File

@ -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",

View File

@ -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);
}
}
</script>

View File

@ -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);
},
};

View File

@ -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
@ -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);
}
}
</script>