fix: reload booking data from API when no user edits are pending

This commit is contained in:
Björn Fromme
2026-07-10 14:33:09 +02:00
parent 0b2a16d117
commit 4e26b8acc0
2 changed files with 17 additions and 1 deletions
@@ -238,9 +238,14 @@ class IndexController extends AbstractController
// Clear session state
$this->bookingSessionService->clearBookingDto($request, BookingDto::MODE_EDIT);
// Check if a draft exists to show appropriate message
/** @var User $user */
$user = $this->getUser();
// Invalidate booking cache so a direct re-entry to /edit (bypassing /start)
// still loads live data rather than the 5-minute cached response.
$this->dataLoader->invalidateBookingCache($bookingId, $user);
// Check if a draft exists to show appropriate message
$draft = $this->draftService->findDraft($user, $bookingId);
if (null !== $draft) {
+11
View File
@@ -85,6 +85,17 @@ class BookingEditDataLoader
return $this->initializeFromApi($request, $bookingId, $user);
}
// No user edits pending — discard the session and reload live from API so that
// BusPro-side changes (participant data, status, surcharges) are immediately
// visible. isDirty() also returns false when originalFingerprint is null
// (inconsistent session state), which is equally safe to reload.
if (!$this->fingerprintService->isDirty($formData)) {
$this->bookingSessionService->clearBookingDto($request, BookingDto::MODE_EDIT);
$this->invalidateBookingCache($bookingId, $user);
return $this->initializeFromApi($request, $bookingId, $user);
}
// Refresh availability and mutability data to ensure current state.
// Availability is refreshed on every load; mutability is patched from cache.
$this->travelDataService->enrichWithFreshAvailabilities($formData->travel);