From 03c76715353f87affe1de1f90d8e926544cd3f63 Mon Sep 17 00:00:00 2001 From: Usama Idriss Kakumba <53287480+usamaidrsk@users.noreply.github.com> Date: Wed, 11 Dec 2024 09:19:25 +0300 Subject: [PATCH] fix: fix reset attribute search fields (#1406) --- .../patient-search-page/advanced-patient-search.component.tsx | 2 +- .../refine-search/refine-search.component.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/esm-patient-search-app/src/patient-search-page/advanced-patient-search.component.tsx b/packages/esm-patient-search-app/src/patient-search-page/advanced-patient-search.component.tsx index 35e9dc6ed..1e2d6f968 100644 --- a/packages/esm-patient-search-app/src/patient-search-page/advanced-patient-search.component.tsx +++ b/packages/esm-patient-search-app/src/patient-search-page/advanced-patient-search.component.tsx @@ -109,7 +109,7 @@ const AdvancedPatientSearchComponent: React.FC = ({ const patientAttributeValue = isValueObj ? (matchingAttribute.value as OpenmrsResource).uuid : matchingAttribute.value; - if (patientAttributeValue !== value) { + if ((patientAttributeValue as string).toLowerCase() !== value.toLowerCase()) { return false; } } diff --git a/packages/esm-patient-search-app/src/patient-search-page/refine-search/refine-search.component.tsx b/packages/esm-patient-search-app/src/patient-search-page/refine-search/refine-search.component.tsx index 1547b3e27..5a35f1328 100644 --- a/packages/esm-patient-search-app/src/patient-search-page/refine-search/refine-search.component.tsx +++ b/packages/esm-patient-search-app/src/patient-search-page/refine-search/refine-search.component.tsx @@ -52,7 +52,7 @@ const RefineSearch: React.FC = ({ setFilters, inTabletOrOverl (data: AdvancedPatientSearchState) => { const cleanedAttributes = Object.entries(data.attributes || {}).reduce( (acc, [key, value]) => { - if (value !== '') { + if (value) { acc[key] = value; } return acc; @@ -71,7 +71,7 @@ const RefineSearch: React.FC = ({ setFilters, inTabletOrOverl [setFilters], ); const handleResetFields = useCallback(() => { - reset(); + reset({ ...initialFilters, attributes: {} }); setFilters(initialFilters); setShowRefineSearchDialog(false); }, [reset, setFilters]);