Skip to content

Commit eea10f2

Browse files
committed
WEB-4460 re-run prune hook on clinic change
1 parent 95a83a9 commit eea10f2

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

app/pages/clinicworkspace/TideDashboardV2/usePruneInvalidFilters.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ const usePruneInvalidFilters = () => {
1111
const clinic = useSelector(state => state.blip.clinics?.[selectedClinicId]);
1212
const { patientTags, clinicSites } = useSelector(state => state.blip.tideDashboardFilters);
1313

14+
const clinicId = clinic?.id;
15+
1416
useEffect(() => {
15-
if (!patientTags?.length || !clinic) return;
17+
if (!patientTags?.length || !clinicId) return;
1618

1719
if (isEqual(patientTags, SPECIAL_FILTER_STATES.ZERO_TAGS)) return;
1820

@@ -22,10 +24,10 @@ const usePruneInvalidFilters = () => {
2224
if (prunedTags.length < patientTags.length) {
2325
dispatch(setPatientTagsFilter(prunedTags));
2426
}
25-
}, []);
27+
}, [clinicId]);
2628

2729
useEffect(() => {
28-
if (!clinicSites?.length || !clinic) return;
30+
if (!clinicSites?.length || !clinicId) return;
2931

3032
if (isEqual(clinicSites, SPECIAL_FILTER_STATES.ZERO_SITES)) return;
3133

@@ -35,7 +37,7 @@ const usePruneInvalidFilters = () => {
3537
if (prunedSites.length < clinicSites.length) {
3638
dispatch(setClinicSitesFilter(prunedSites));
3739
}
38-
}, []);
40+
}, [clinicId]);
3941
};
4042

4143
export default usePruneInvalidFilters;

0 commit comments

Comments
 (0)