From 22ba6b3ba534d3258025d68a9dc57bda25152ea9 Mon Sep 17 00:00:00 2001 From: vivek Date: Sun, 29 Oct 2023 14:04:40 +0530 Subject: [PATCH] fix listfilter --- src/Components/Resource/BadgesList.tsx | 10 +++++++--- src/Components/Resource/ListFilter.tsx | 12 +++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/Components/Resource/BadgesList.tsx b/src/Components/Resource/BadgesList.tsx index 1b5a28a8209..bc60927b87c 100644 --- a/src/Components/Resource/BadgesList.tsx +++ b/src/Components/Resource/BadgesList.tsx @@ -37,16 +37,20 @@ export default function BadgesList(props: any) { }), ...dateRange("Modified", "modified_date"), ...dateRange("Created", "created_date"), - value("Origin facility", "origin_facility", originFacility?.data?.name), + value( + "Origin facility", + "origin_facility", + originFacility?.data?.name || "" + ), value( "Approving facility", "approving_facility", - approvingFacility?.data?.name + approvingFacility?.data?.name || "" ), value( "Assigned facility", "assigned_facility", - assignedFacility?.data?.name + assignedFacility?.data?.name || "" ), ]} /> diff --git a/src/Components/Resource/ListFilter.tsx b/src/Components/Resource/ListFilter.tsx index 566469d0f2a..afe48eedfd0 100644 --- a/src/Components/Resource/ListFilter.tsx +++ b/src/Components/Resource/ListFilter.tsx @@ -57,7 +57,9 @@ export default function ListFilter(props: any) { pathParams: { id: filter.origin_facility }, onResponse: ({ res, data }) => { if (res && data) { - setFilterState({ origin_facility_ref: data }); + setFilterState({ + origin_facility_ref: filter.origin_facility === "" ? "" : data, + }); } }, }); @@ -67,7 +69,9 @@ export default function ListFilter(props: any) { pathParams: { id: filter.approving_facility }, onResponse: ({ res, data }) => { if (res && data) { - setFilterState({ approving_facility_ref: data }); + setFilterState({ + approving_facility_ref: filter.approving_facility === "" ? "" : data, + }); } }, }); @@ -77,7 +81,9 @@ export default function ListFilter(props: any) { prefetch: filter.assigned_facility !== undefined, onResponse: ({ res, data }) => { if (res && data) { - setFilterState({ assigned_facility_ref: data }); + setFilterState({ + assigned_facility_ref: filter.assigned_facility === "" ? "" : data, + }); } }, });