From 24a85b0f916d0ca5c7a1b5263adc8b562dc782db Mon Sep 17 00:00:00 2001 From: jubnl Date: Tue, 21 Apr 2026 19:54:43 +0200 Subject: [PATCH] fix(reservations): clear location when accommodation place is removed When hotel_place_id is cleared in the modal, also clear the location field that was auto-filled from the place. Location is hidden for hotel type so users had no way to remove the stale address after unlinking. --- .../src/components/Planner/ReservationModal.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/client/src/components/Planner/ReservationModal.tsx b/client/src/components/Planner/ReservationModal.tsx index d0a41448..7064b4a5 100644 --- a/client/src/components/Planner/ReservationModal.tsx +++ b/client/src/components/Planner/ReservationModal.tsx @@ -417,12 +417,17 @@ export function ReservationModal({ isOpen, onClose, onSave, reservation, days, p { - set('hotel_place_id', value) const p = places.find(pl => pl.id === value) - if (p) { - if (!form.title) set('title', p.name) - if (!form.location && p.address) set('location', p.address) - } + setForm(prev => { + const next = { ...prev, hotel_place_id: value } + if (!value) { + next.location = '' + } else if (p) { + if (!prev.title) next.title = p.name + if (!prev.location && p.address) next.location = p.address + } + return next + }) }} placeholder={t('reservations.meta.pickHotel')} options={[