Skip to content

Commit

Permalink
fix: Reset TimeSlotSelector value when changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-LHOSTE committed Jun 19, 2024
1 parent b276b20 commit 3c3e1bd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/navigation/store/NewDeliveryForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,11 @@ function NewDelivery(props) {
}, [props.timeSlots]);

useEffect(() => {
setSelectValue(null);
if (selectedTimeSlot) {
props.loadTimeSlotChoices(
props.timeSlots.find(ts => ts.name === selectedTimeSlot),
);
} else {
setSelectValue(null);
}
}, [selectedTimeSlot, props.loadTimeSlotChoices, props.timeSlots]);

Check failure on line 72 in src/navigation/store/NewDeliveryForm.js

View workflow job for this annotation

GitHub Actions / Basic tests

React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the useEffect call and refer to those specific props inside useEffect

Check failure on line 72 in src/navigation/store/NewDeliveryForm.js

View workflow job for this annotation

GitHub Actions / Basic tests

React Hook useEffect has a missing dependency: 'props'. Either include it or remove the dependency array. However, 'props' will change when *any* prop changes, so the preferred fix is to destructure the 'props' object outside of the useEffect call and refer to those specific props inside useEffect

Expand Down

0 comments on commit 3c3e1bd

Please sign in to comment.