From a81fe3da0a0eb53cf12a98b00dc1011fd734fedc Mon Sep 17 00:00:00 2001 From: jubnl Date: Tue, 21 Apr 2026 18:52:24 +0200 Subject: [PATCH] fix(reservations): clear editingReservation after successful save When a reservation was saved, only setShowReservationModal(false) was called. The modal's useEffect watches [reservation, isOpen, ...], so flipping isOpen to false re-ran the effect with the stale editingReservation (old assignment_id), resetting the form to the pre-edit state during the closing animation. Users perceived this as the value reverting after save. Calling setEditingReservation(null) immediately after the close mirrors the existing onClose handler and prevents the stale-prop form reset. --- client/src/pages/TripPlannerPage.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/client/src/pages/TripPlannerPage.tsx b/client/src/pages/TripPlannerPage.tsx index fe38e85b..dd514b38 100644 --- a/client/src/pages/TripPlannerPage.tsx +++ b/client/src/pages/TripPlannerPage.tsx @@ -642,6 +642,7 @@ export default function TripPlannerPage(): React.ReactElement | null { const r = await tripActions.updateReservation(tripId, editingReservation.id, { ...data, day_id: selectedDayId || null }) toast.success(t('trip.toast.reservationUpdated')) setShowReservationModal(false) + setEditingReservation(null) if (data.type === 'hotel') { accommodationsApi.list(tripId).then(d => setTripAccommodations(d.accommodations || [])).catch(() => {}) }