From 89084229f85ecbd8ca66c83e9d63a109a98cfb25 Mon Sep 17 00:00:00 2001 From: ahmadshaheer Date: Mon, 10 Mar 2025 13:15:48 +0430 Subject: [PATCH 1/2] fix: display same key with multiple data types in filter suggestions by enhancing the deduping logic --- frontend/src/hooks/queryBuilder/useOptions.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/hooks/queryBuilder/useOptions.ts b/frontend/src/hooks/queryBuilder/useOptions.ts index e990f789dee..d61a21aa782 100644 --- a/frontend/src/hooks/queryBuilder/useOptions.ts +++ b/frontend/src/hooks/queryBuilder/useOptions.ts @@ -170,7 +170,12 @@ export const useOptions = ( (option, index, self) => index === self.findIndex( - (o) => o.label === option.label && o.value === option.value, // to remove duplicate & empty options from list + (o) => + // to remove duplicate & empty options from list + o.label === option.label && + o.value === option.value && + o.dataType?.trim()?.toLowerCase() === + option.dataType?.trim()?.toLowerCase(), // handle case sensitivity and leading/trailing spaces ) && option.value !== '', ) || [] ).map((option) => { From d094c220a78a9a2626fd758470598604731ef94a Mon Sep 17 00:00:00 2001 From: ahmadshaheer Date: Mon, 10 Mar 2025 17:25:54 +0430 Subject: [PATCH 2/2] refactor: remove unnecessary .trim() --- frontend/src/hooks/queryBuilder/useOptions.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/hooks/queryBuilder/useOptions.ts b/frontend/src/hooks/queryBuilder/useOptions.ts index d61a21aa782..7f50f1881b8 100644 --- a/frontend/src/hooks/queryBuilder/useOptions.ts +++ b/frontend/src/hooks/queryBuilder/useOptions.ts @@ -174,8 +174,7 @@ export const useOptions = ( // to remove duplicate & empty options from list o.label === option.label && o.value === option.value && - o.dataType?.trim()?.toLowerCase() === - option.dataType?.trim()?.toLowerCase(), // handle case sensitivity and leading/trailing spaces + o.dataType?.toLowerCase() === option.dataType?.toLowerCase(), // handle case sensitivity ) && option.value !== '', ) || [] ).map((option) => {