mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-06 10:44:23 +00:00
fix(planner): a refresh of the trip no longer wipes an open transport or booking form
The transport form re-seeded itself whenever the trip's costs arrived as a new array, and the booking form whenever days, places or stays did. A socket reconnect re-reads the whole trip, so behind a proxy that drops idle sockets every 15 to 30 seconds everything typed so far was wiped. Both forms now re-seed only for what opens a different form; the data is read when the form is seeded, as before. Fixes #3069
This commit is contained in:
@@ -132,8 +132,12 @@ export function ReservationModal({ isOpen, onClose, onSave, reservation, days, p
|
||||
setForm({ ...EMPTY_FORM, assignment_id: defaultAssignmentId ?? '' })
|
||||
setPendingFiles([])
|
||||
}
|
||||
// Keyed only on what opens a different form. Days, places and stays are read
|
||||
// when the form is seeded; a refresh of the trip while the dialog is open (a
|
||||
// socket reconnect re-reads it) hands in new arrays of the same data and must
|
||||
// not reseed it and wipe what the user is typing (#3069).
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [reservation, prefill, isOpen, selectedDayId, defaultAssignmentId, days, places, accommodations])
|
||||
}, [reservation, prefill, isOpen, selectedDayId, defaultAssignmentId])
|
||||
|
||||
const handleSubmit = async (e?: { preventDefault?: () => void }) => {
|
||||
e?.preventDefault?.()
|
||||
|
||||
Reference in New Issue
Block a user