From ded6c5f77d84d16b58802c0f9062aeaa855daf46 Mon Sep 17 00:00:00 2001 From: shashwatbangar Date: Fri, 27 May 2022 16:22:44 +0530 Subject: [PATCH 1/3] Fixed:When including a tag, the product count does not update if the tag does not contain any product(#2dmha76) --- src/store/modules/product/actions.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index d735c0db..8efd1f47 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -41,6 +41,8 @@ const actions: ActionTree = { } commit(types.PRODUCT_LIST_UPDATED, { products, totalVirtual, totalVariant }); } else { + state.products.total.virtual = 0; + state.products.total.variant = 0; showToast(translate("Products not found")); commit(types.PRODUCT_LIST_UPDATED, { products: [], totalVirtual: state.products.total.virtual, totalVariant: state.products.total.variant }); } From 966ca5479c68c1f687fb7cd6c83a68ddcc0426d3 Mon Sep 17 00:00:00 2001 From: shashwatbangar Date: Fri, 27 May 2022 17:03:40 +0530 Subject: [PATCH 2/3] Fixed: When including a tag, the product count does not update if the tag does not contain any product logic(#2dmha76) --- src/store/modules/product/actions.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index 8efd1f47..f9da4b90 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -40,9 +40,10 @@ const actions: ActionTree = { totalVariant = state.products.total.variant } commit(types.PRODUCT_LIST_UPDATED, { products, totalVirtual, totalVariant }); + } else if(query.json.query === "*:*") { + showToast(translate("Products not found")); + commit(types.PRODUCT_LIST_UPDATED, { products: [], totalVirtual: 0, totalVariant: 0 }); } else { - state.products.total.virtual = 0; - state.products.total.variant = 0; showToast(translate("Products not found")); commit(types.PRODUCT_LIST_UPDATED, { products: [], totalVirtual: state.products.total.virtual, totalVariant: state.products.total.variant }); } From 6ab8de4e734ca076df339da3efc82cb26529bb14 Mon Sep 17 00:00:00 2001 From: shashwatbangar Date: Fri, 27 May 2022 18:06:06 +0530 Subject: [PATCH 3/3] Improved: Further optimzed - Threshold management(#2dmha76) code --- src/store/modules/product/actions.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index f9da4b90..84a659c4 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -40,12 +40,9 @@ const actions: ActionTree = { totalVariant = state.products.total.variant } commit(types.PRODUCT_LIST_UPDATED, { products, totalVirtual, totalVariant }); - } else if(query.json.query === "*:*") { - showToast(translate("Products not found")); - commit(types.PRODUCT_LIST_UPDATED, { products: [], totalVirtual: 0, totalVariant: 0 }); } else { showToast(translate("Products not found")); - commit(types.PRODUCT_LIST_UPDATED, { products: [], totalVirtual: state.products.total.virtual, totalVariant: state.products.total.variant }); + commit(types.PRODUCT_LIST_UPDATED, { products: [], totalVirtual: query.json.query === "*:*" ? 0 : state.products.total.virtual, totalVariant: query.json.query === "*:*" ? 0 : state.products.total.variant }); } } catch (error) { console.error(error);