From 0cb0567d2817c6f64ec6bd1a9112b76e41688650 Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 26 Jun 2026 15:57:18 +0200 Subject: [PATCH] fix(import): refresh costs immediately after an imported booking is saved The saving client gets no budget:created echo (X-Socket-Id) and the create response omits the linked budget item, so the booking's Costs section and the Costs tab stayed stale until a manual reload. Reload the budget items right after a create that carried a budget entry. --- client/src/pages/tripPlanner/useTripPlanner.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/client/src/pages/tripPlanner/useTripPlanner.ts b/client/src/pages/tripPlanner/useTripPlanner.ts index b9abb7cd..e447d2ea 100644 --- a/client/src/pages/tripPlanner/useTripPlanner.ts +++ b/client/src/pages/tripPlanner/useTripPlanner.ts @@ -613,6 +613,9 @@ export function useTripPlanner() { const r = await tripActions.addReservation(tripId, { ...data, day_id: selectedDayId || null }) toast.success(t('trip.toast.reservationAdded')) setShowReservationModal(false) + // An imported booking auto-creates a linked cost server-side; the saving client gets + // no budget:created echo, so refresh the budget items here to surface it without a reload. + if ((data as Record).create_budget_entry) await tripActions.loadBudgetItems?.(tripId) // Refresh accommodations if hotel was created if (data.type === 'hotel') { accommodationsApi.list(tripId).then(d => setTripAccommodations(d.accommodations || [])).catch(() => {}) @@ -637,6 +640,8 @@ export function useTripPlanner() { setShowTransportModal(false) setEditingTransport(null) setTransportModalDayId(null) + // Surface the auto-created linked cost without a reload (no budget:created echo to us). + if (data.create_budget_entry) await tripActions.loadBudgetItems?.(tripId) return r } } catch (err: unknown) { toast.error(err instanceof Error ? err.message : t('common.unknownError')) }