Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(reservations): clear location when accommodation place is removed

jubnl24a85b0f916d
diff --git a/client/src/components/Planner/ReservationModal.tsx b/client/src/components/Planner/ReservationModal.tsx
index d0a41448a..7064b4a54 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
<CustomSelect
value={form.hotel_place_id}
onChange={value => {
- 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={[