From 74f27379ca7edfb6c57ddf18e937fba692767d56 Mon Sep 17 00:00:00 2001 From: Onkar Jadhav Date: Mon, 15 Jan 2024 11:35:46 +0530 Subject: [PATCH] Fix inconsistent removal of facility filters --- src/Components/Facility/HospitalList.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Components/Facility/HospitalList.tsx b/src/Components/Facility/HospitalList.tsx index 075ad8de39e..36b5886c796 100644 --- a/src/Components/Facility/HospitalList.tsx +++ b/src/Components/Facility/HospitalList.tsx @@ -4,7 +4,7 @@ import { downloadFacilityDoctors, downloadFacilityTriage, } from "../../Redux/actions"; -import { lazy } from "react"; +import { lazy, useEffect } from "react"; import { AdvancedFilterButton } from "../../CAREUI/interactive/FiltersSlideover"; import CountBlock from "../../CAREUI/display/Count"; import ExportMenu from "../Common/Export"; @@ -35,6 +35,16 @@ export const HospitalList = () => { } = useFilters({ limit: 14, }); + + useEffect(() => { + if (!qParams.state) { + advancedFilter.removeFilters(["district", "local_body"]); + } + if (!qParams.district) { + advancedFilter.removeFilters(["local_body"]); + } + }, [advancedFilter, qParams]); + let manageFacilities: any = null; const { user_type } = useAuthUser(); const { t } = useTranslation();