Skip to content

Commit

Permalink
Fix inconsistent removal of facility filters (#7031)
Browse files Browse the repository at this point in the history
* Fix inconsistent removal of facility filters

* Fix filter cache problem

* Make the condition for empty qParam check more readable

* Apply review suggestions to filter inconsistency issue
  • Loading branch information
Omkar76 authored Jan 23, 2024
1 parent a36f2b0 commit 5c08e16
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/Components/Facility/HospitalList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -36,6 +36,16 @@ export const HospitalList = () => {
limit: 14,
cacheBlacklist: ["search"],
});

useEffect(() => {
if (!qParams.state && (qParams.district || qParams.local_body)) {
advancedFilter.removeFilters(["district", "local_body"]);
}
if (!qParams.district && qParams.local_body) {
advancedFilter.removeFilters(["local_body"]);
}
}, [advancedFilter, qParams]);

let manageFacilities: any = null;
const { user_type } = useAuthUser();
const { t } = useTranslation();
Expand Down

0 comments on commit 5c08e16

Please sign in to comment.