Skip to content
This repository has been archived by the owner on Feb 1, 2024. It is now read-only.

Commit

Permalink
Separate and add deps to FilterSidebarExtendedSearch hooks
Browse files Browse the repository at this point in the history
The original hook generated a lint warning for the missing dependencies. Using a
single hook resulted in repeat fetches so we split out a separate hook for each
distinct fetch.
  • Loading branch information
jwalgran committed Mar 19, 2022
1 parent eef79c3 commit c45b9ab
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/src/components/FilterSidebarExtendedSearch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,19 +148,25 @@ function FilterSidebarExtendedSearch({
if (!contributorTypeOptions.length) {
fetchContributorTypes();
}
}, [contributorTypeOptions, fetchContributorTypes]);

useEffect(() => {
if (!facilityProcessingTypeOptions.length) {
fetchFacilityProcessingType();
}
}, [facilityProcessingTypeOptions, fetchFacilityProcessingType]);

useEffect(() => {
if (!productTypeOptions.length) {
fetchProductType();
}
}, [productTypeOptions, fetchProductType]);

useEffect(() => {
if (!numberOfWorkersOptions.length) {
fetchNumberOfWorkers();
}
}, []);
}, [numberOfWorkersOptions, fetchNumberOfWorkers]);

if (fetchingExtendedOptions) {
return (
Expand Down

0 comments on commit c45b9ab

Please sign in to comment.