From d0a8eca5cfd6a4b5ac5ccf6022a0527c6d79c2f9 Mon Sep 17 00:00:00 2001 From: Benjamin Arias Date: Mon, 9 Sep 2024 16:44:48 +0200 Subject: [PATCH] :bug: Fix assistance car km [NGC-1064] (#689) --- src/components/specialQuestions/voiture/JourneysInput.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/specialQuestions/voiture/JourneysInput.tsx b/src/components/specialQuestions/voiture/JourneysInput.tsx index 8c0b4f329..d6c15c569 100644 --- a/src/components/specialQuestions/voiture/JourneysInput.tsx +++ b/src/components/specialQuestions/voiture/JourneysInput.tsx @@ -84,11 +84,14 @@ export default function JourneysInput({ question, setTempValue }: Props) { const prevTotal = useRef(total) + useEffect(() => { + setNumPassengers(averagePassengers) + }, [averagePassengers, setNumPassengers]) + useEffect(() => { if (prevTotal.current !== total) { if (setTempValue) setTempValue(total) setValue(total, { foldedStep: question }) - setNumPassengers(averagePassengers) } prevTotal.current = total }, [