fix: reload booking data from API when no user edits are pending
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user