Corrections dépendantes useEffect

This commit is contained in:
Emmy D'Anello 2024-06-10 00:41:26 +02:00
parent 3193c920ec
commit 67894a80c3
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 5 additions and 5 deletions

View File

@ -148,7 +148,7 @@ export default function Election2024({typeResultats = "france"}) {
fetch(`/data/resultats/europeennes2024/${typeResultats}/${zoneId}.json`).then(response => response.json())
.then(data => setResultats(data))
}
}, [])
}, [typeResultats, zoneId])
useEffect(() => {
const parBloc = {}
@ -167,7 +167,7 @@ export default function Election2024({typeResultats = "france"}) {
setVoixParBloc(parBloc)
setVoixParNuance(parNuance)
}, [resultats])
}, [blocs, nuances, listes, resultats])
useEffect(() => {
const categories = []
@ -234,7 +234,7 @@ export default function Election2024({typeResultats = "france"}) {
}
setSiegesParListe(sieges)
}, [resultats, retirerSeuil])
}, [listes, resultats, retirerSeuil])
useEffect(() => {
const parBloc = {}
@ -253,7 +253,7 @@ export default function Election2024({typeResultats = "france"}) {
setSiegesParBloc(parBloc)
setSiegesParNuance(parNuance)
}, [siegesParListe])
}, [blocs, nuances, listes, siegesParListe])
useEffect(() => {
const data = []
@ -268,7 +268,7 @@ export default function Election2024({typeResultats = "france"}) {
}
}
setDataSieges(data)
}, [siegesParBloc, siegesParNuance, grouperParBloc])
}, [blocs, nuances, siegesParBloc, siegesParNuance, grouperParBloc])
const compositonOptions = {
chart: {