From 0b4d97386c1be5f98056bac1ec5208438f53b044 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Mon, 29 Jan 2024 15:30:53 +0530 Subject: [PATCH] Fixed: a case when adding and removing a filter for which the value type changes from the app side by removing strict equality checking for value field and added check to not update promiseDate value when popover is closed without any action --- src/views/BrokeringQuery.vue | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/views/BrokeringQuery.vue b/src/views/BrokeringQuery.vue index 2d3436c..0e87558 100644 --- a/src/views/BrokeringQuery.vue +++ b/src/views/BrokeringQuery.vue @@ -528,7 +528,9 @@ async function selectPromiseFilterValue(ev: CustomEvent) { }) popover.onDidDismiss().then((result: any) => { - getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE").fieldValue = result.data?.isPastDuration ? `-${result.data?.duration}` : result.data?.duration + if(result.data?.duration || result.data?.duration == 0) { + getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE").fieldValue = result.data?.isPastDuration ? `-${result.data?.duration}` : result.data?.duration + } getFilterValue(orderRoutingFilterOptions.value, ruleEnums, "PROMISE_DATE").operator = "less-equals" }) @@ -694,7 +696,8 @@ function findFilterDiff(previousSeq: any, updatedSeq: any) { return diff } - if (updatedSeq[key].fieldName === previousSeq[key].fieldName && updatedSeq[key].fieldValue === previousSeq[key].fieldValue && updatedSeq[key].operator === previousSeq[key].operator) return diff + // Not using strict equality comparison for fieldValue as for some filters the type of value returned from server and the updated value from the app will not be the same(ex. Promise date filter) + if (updatedSeq[key].fieldName === previousSeq[key].fieldName && updatedSeq[key].fieldValue == previousSeq[key].fieldValue && updatedSeq[key].operator === previousSeq[key].operator) return diff return { ...diff, [key]: updatedSeq[key] @@ -726,7 +729,8 @@ function findActionDiff(previousSeq: any, updatedSeq: any) { return diff } - if (updatedSeq[key].actionTypeEnumId === previousSeq[key].actionTypeEnumId && updatedSeq[key].actionValue === previousSeq[key].actionValue) return diff + // Not using strict equality comparison for actionValue as for some filters the type of value returned from server and the updated value from the app will not be the same. + if (updatedSeq[key].actionTypeEnumId === previousSeq[key].actionTypeEnumId && updatedSeq[key].actionValue == previousSeq[key].actionValue) return diff return { ...diff, [key]: updatedSeq[key]