mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 03:26:07 +00:00
fix(planner): a stay booked elsewhere shows without a reload
The server sends accommodation:created and accommodation:updated to the whole trip, the assistant's writes included, but the client listed both as ignored and reloaded stays only after a delete. A stay the assistant, a fellow traveller, a plugin or a booking import added therefore showed in the sidebar, on the map and in the day panel only after a reload. Both events now refresh the stays like the deletes do, in the planner (desktop and phone, which share its hook) and in the day panel. The refresh is bundled per burst, since one assistant step can apply many changes, a newer answer always wins over an older one, and a stay being edited in the day panel that was deleted or moved elsewhere closes its editor instead of letting the form overwrite another stay. A browser test books a stay from a second context and sees it appear in the open planner, on the desktop and on the phone.
This commit is contained in:
@@ -106,6 +106,15 @@ export const HANDLED_OUTSIDE_TRIP_STORE = [
|
||||
'import:progress',
|
||||
'import:done',
|
||||
'import:error',
|
||||
// Stays live in page-local planner state, not in the trip store. A stay
|
||||
// written elsewhere (the assistant, a fellow traveller, a plugin, a booking
|
||||
// import) goes remoteEventHandler (STAY_REFRESH_EVENTS) -> accommodations:refresh
|
||||
// -> components/Planner/useStaysRefresh, which reloads them once per burst in
|
||||
// pages/tripPlanner/useTripPlanner (sidebar, map, the phone's day sheet) and
|
||||
// components/Planner/useDayDetail (the desktop day panel).
|
||||
'accommodation:created',
|
||||
'accommodation:updated',
|
||||
'accommodation:deleted',
|
||||
] as const satisfies readonly TrekWsEventName[]
|
||||
|
||||
/**
|
||||
@@ -129,11 +138,6 @@ export const IGNORED_WS_EVENTS = [
|
||||
'budget:settlement-created',
|
||||
'budget:settlement-updated',
|
||||
'budget:settlement-deleted',
|
||||
// Accommodations live in page-local planner state; the client refetches
|
||||
// them off trip:updated date changes, never off these events.
|
||||
'accommodation:created',
|
||||
'accommodation:updated',
|
||||
'accommodation:deleted',
|
||||
'trip:deleted',
|
||||
'member:added',
|
||||
'member:removed',
|
||||
|
||||
Reference in New Issue
Block a user