From 8b48f0749452805abcac47b0ea3ffe901ee09fde Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 16 Feb 2024 18:58:32 +0530 Subject: [PATCH 1/2] Improved: handling when failed to fetch the routing Rule information(#106) --- src/views/BrokeringQuery.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue index 330f4fc..6073276 100644 --- a/src/views/BrokeringQuery.vue +++ b/src/views/BrokeringQuery.vue @@ -425,8 +425,8 @@ async function fetchRuleInformation(routingRuleId: string) { // Using currentRouting["rules"] deep-cloned object here, as we will update the change in rules with route changes and not with rules filter changes selectedRoutingRule.value = inventoryRules.value.find((rule: Rule) => rule.routingRuleId === routingRuleId) - // Even after fetching the rule is not found then initializing the selectedRouting to empty object - if(!selectedRoutingRule.value) { + // If failed to fetch the current routing rule information + if(!selectedRoutingRule.value || !rulesInformation.value[routingRuleId]) { selectedRoutingRule.value = {} } @@ -516,7 +516,7 @@ async function addInventoryRule() { const routingRuleId = await store.dispatch("orderRouting/createRoutingRule", payload) if(routingRuleId) { // TODO: Fix warning of duplicate keys when creating a new rule - inventoryRules.value = JSON.parse(JSON.stringify(currentRouting.value["rules"])) + inventoryRules.value = sortSequence(JSON.parse(JSON.stringify(currentRouting.value["rules"]))) fetchRuleInformation(routingRuleId) } } From 32247c588a474e121dbd449ee7db99374ac51b37 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 16 Feb 2024 19:08:03 +0530 Subject: [PATCH 2/2] ImprovedL: handling for routingRules when fetching a new rule information(#106) --- src/views/BrokeringQuery.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue index 6073276..93eaf6f 100644 --- a/src/views/BrokeringQuery.vue +++ b/src/views/BrokeringQuery.vue @@ -426,7 +426,7 @@ async function fetchRuleInformation(routingRuleId: string) { selectedRoutingRule.value = inventoryRules.value.find((rule: Rule) => rule.routingRuleId === routingRuleId) // If failed to fetch the current routing rule information - if(!selectedRoutingRule.value || !rulesInformation.value[routingRuleId]) { + if(!selectedRoutingRule.value || !rulesInformation.value[routingRuleId]?.routingRuleId) { selectedRoutingRule.value = {} }