Skip to content

Commit

Permalink
Fix bug with old hours not updating (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathildehaugum authored Nov 27, 2023
1 parent e0bc6f5 commit 4609bb2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions frontend/src/components/ConsultantRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ function DetailedBookingCell({
}) {
const { setConsultants } = useContext(FilteredContext);
const [hours, setHours] = useState(detailedBookingHours.hours);
const [oldHours] = useState(detailedBookingHours.hours);
const [oldHours, setOldHours] = useState(detailedBookingHours.hours);
const { setIsDisabledHotkeys } = useContext(FilteredContext);
const router = useRouter();

Expand All @@ -513,12 +513,13 @@ function DetailedBookingCell({
consultant.id,
detailedBooking.bookingDetails.projectId,
detailedBookingHours.week,
).then((res) =>
).then((res) => {
setConsultants((old) => [
// Use spread to make a new list, forcing a re-render
...upsertConsultantWithSingleWeekBooking(old, res),
]),
);
]);
setOldHours(hourDragValue ?? hours);
});
}
}

Expand Down

0 comments on commit 4609bb2

Please sign in to comment.