diff --git a/ui/src/campagnes/CreateCampagnes/FormationsSelector.js b/ui/src/campagnes/CreateCampagnes/FormationsSelector.js index b12c96f4..3d52029b 100644 --- a/ui/src/campagnes/CreateCampagnes/FormationsSelector.js +++ b/ui/src/campagnes/CreateCampagnes/FormationsSelector.js @@ -11,7 +11,7 @@ import BeatLoader from "react-spinners/BeatLoader"; import { DIPLOME_TYPE_MATCHER, USER_ROLES, VIEW_TYPES } from "../../constants"; import { UserContext } from "../../context/UserContext"; import useFetchCampagnes from "../../hooks/useFetchCampagnes"; -import useFetchDiplomesWithCampagnesCount from "../../hooks/useFetchDiplomesWithCampagnesCount"; +import useFetchDiplomesAndEtablissementsFilter from "../../hooks/useFetchDiplomesAndEtablissementsFilter"; import useFetchRemoteFormations from "../../hooks/useFetchRemoteFormations"; import { remoteEtablissementLabelGetterFromFormation } from "../../utils/etablissement"; import FilterButtons from "../Shared/FilterButtons/FilterButtons"; @@ -114,7 +114,7 @@ const FormationsSelector = ({ selectedFormations, setSelectedFormations }) => { diplomesFilter, etablissementsFilter, isSuccess: isSuccessDiplomesAndEtablissementsFilter, - } = useFetchDiplomesWithCampagnesCount(); + } = useFetchDiplomesAndEtablissementsFilter(); const { campagnes: campagnes, @@ -185,7 +185,7 @@ const FormationsSelector = ({ selectedFormations, setSelectedFormations }) => { /> )} <> - {isSuccessFormations && ( + {isSuccessDiplomesAndEtablissementsFilter && ( <> campagne.id); diff --git a/ui/src/campagnes/Shared/FilterButtons/FilterButtons.js b/ui/src/campagnes/Shared/FilterButtons/FilterButtons.js index 43abb22f..bfeb79c9 100644 --- a/ui/src/campagnes/Shared/FilterButtons/FilterButtons.js +++ b/ui/src/campagnes/Shared/FilterButtons/FilterButtons.js @@ -36,13 +36,13 @@ const FilterButtons = ({ }, [inputValue, setSearch, setIsOpened]); useEffect(() => { - if (!selectedEtablissementsSiret) { + if (!selectedEtablissementsSiret?.length) { setSelectedEtablissementsSiret(etablissementsOptions.map((option) => option.value)); } }, [selectedEtablissementsSiret, etablissementsOptions]); useEffect(() => { - if (!selectedDiplomesIntitule) { + if (!selectedDiplomesIntitule?.length) { setSelectedDiplomesIntitule(diplomesOptions.map((option) => option.value)); } }, [diplomesOptions]); diff --git a/ui/src/hooks/useFetchDiplomesWithCampagnesCount.js b/ui/src/hooks/useFetchDiplomesAndEtablissementsFilter.js similarity index 100% rename from ui/src/hooks/useFetchDiplomesWithCampagnesCount.js rename to ui/src/hooks/useFetchDiplomesAndEtablissementsFilter.js