From b7415eff4598706647541005953582c529bfaeef Mon Sep 17 00:00:00 2001 From: Aditya Sharma Date: Fri, 27 May 2022 19:19:52 +0530 Subject: [PATCH] Fixed: product filters not updating on reset, logout and store change (#2dmrnhx) --- src/components/ProductFilterModal.vue | 5 ++++- src/store/modules/product/actions.ts | 10 ++++++++-- src/views/SelectProduct.vue | 8 ++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/components/ProductFilterModal.vue b/src/components/ProductFilterModal.vue index 51846f78..67e2a149 100644 --- a/src/components/ProductFilterModal.vue +++ b/src/components/ProductFilterModal.vue @@ -120,7 +120,10 @@ export default defineComponent({ await this.store.dispatch('product/clearFilters', { type: this.type, id: this.searchfield, - value: [] + value: { + list: [], + operator: 'OR' + } }) this.isFilterChanged = true; }, diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index 43e6970a..69eb1095 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -117,7 +117,10 @@ const actions: ActionTree = { async resetFilters({ commit, state, dispatch }, payload) { const appliedFilters = JSON.parse(JSON.stringify((state.appliedFilters as any)[payload.type])) const value = Object.keys(appliedFilters).reduce((value: any, filter: any) => { - value[filter] = [] + value[filter] = { + list: [], + operator: "OR" + } return value }, {}) commit(types.PRODUCT_FILTERS_UPDATED, {type: payload.type, value}) @@ -128,7 +131,10 @@ const actions: ActionTree = { const appliedFilters = JSON.parse(JSON.stringify(state.appliedFilters)) const value = Object.keys(appliedFilters).reduce((value: any, type: any) => { const val = Object.keys(appliedFilters[type]).reduce((val: any, filter: any) => { - val[filter] = [] + val[filter] = { + list: [], + operator: 'OR' + } return val }, {}) value[type] = val diff --git a/src/views/SelectProduct.vue b/src/views/SelectProduct.vue index a4eb96ec..38d1ddde 100644 --- a/src/views/SelectProduct.vue +++ b/src/views/SelectProduct.vue @@ -41,8 +41,8 @@ {{ $t("Operator") }} - AND - OR + AND + OR @@ -72,8 +72,8 @@ {{ $t("Operator") }} - AND - OR + AND + OR