Skip to content

Commit 2709d30

Browse files
committed
front: fix comfort type not updated after rs change
Signed-off-by: romainvalls <[email protected]>
1 parent 1482e8c commit 2709d30

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

front/src/modules/rollingStock/components/RollingStockCard/RollingStockCardButtons.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,16 @@ const RollingStockCardButtons = ({
6868
}, [curvesComfortList]);
6969

7070
useEffect(() => {
71-
if (curvesComfortList.includes(currentComfortInStore)) {
72-
setComfort(currentComfortInStore);
71+
if (curvesComfortList.length === 0) {
72+
setComfort('STANDARD');
73+
} else {
74+
setComfort(
75+
curvesComfortList.includes(currentComfortInStore)
76+
? currentComfortInStore
77+
: curvesComfortList[0]
78+
);
7379
}
74-
}, [currentComfortInStore]);
80+
}, [curvesComfortList, currentComfortInStore]);
7581

7682
return (
7783
<div className="rollingstock-footer-buttons">

0 commit comments

Comments
 (0)