Passenger portal build issue resolution

This commit is contained in:
Stephanos A
2026-07-22 16:31:03 +03:00
parent 1cb9666796
commit 62fcf6a8d2
2 changed files with 4 additions and 18 deletions

View File

@@ -1,6 +1,7 @@
"use client";
export const dynamic = "force-dynamic";
export const fetchCache = "force-no-store";
import { useRouter } from "next/navigation";
import { useBookingStore } from "@/lib/booking-store";
@@ -105,15 +106,8 @@ export default function ConfirmationPage() {
// common) as normal pending state forever, since a caught error that returns data
// looks like a success to React Query and never gets retried.
queryFn: (): Promise<BookingWithTicket> => apiClient.get(`/bookings/${bookingId}`),
// Payment status must never be served from a stale cache — the app-wide default
// (providers.tsx) is a 60s staleTime, which would otherwise block React Query's
// own refetch-on-window-focus from firing (it only refetches stale data). Without
// this override, a tab left open past a payment completing can sit showing
// "pending" long after it's actually confirmed, even after being refocused,
// until the interval below happens to tick — which browsers throttle heavily in
// backgrounded tabs, so that can take a very long time.
staleTime: 0,
enabled: !!bookingId,
enabled: !!bookingId && typeof window !== 'undefined',
// Keep polling after CONFIRMED until tickets are issued — ticket generation runs
// async after the booking transaction commits (see finalizePaymentSuccess in
// payments.service.ts), so the first CONFIRMED fetch often returns an empty
@@ -143,7 +137,7 @@ export default function ConfirmationPage() {
const { data: intentStatus } = useQuery<any>({
queryKey: ["payment-intent-status", bookingId],
queryFn: () => apiClient.get(`/payments/intents/${bookingId}`),
enabled: _booking?.status === "PENDING_PAYMENT" && !!bookingId,
enabled: _booking?.status === "PENDING_PAYMENT" && !!bookingId && typeof window !== 'undefined',
staleTime: 0,
refetchInterval: () =>
Date.now() - mountTimeRef.current < CONFIRMATION_GRACE_PERIOD_MS
@@ -155,7 +149,7 @@ export default function ConfirmationPage() {
if (intentStatus?.status === "SUCCEEDED") {
refetchBooking();
}
}, [intentStatus?.status]);
}, [intentStatus?.status, refetchBooking]);
// Only trust an actually-confirmed booking to show ticket numbers / a "CONFIRMED" badge —
// a gateway redirect back here does not mean payment succeeded (see payment return pages).

View File

@@ -94,14 +94,6 @@ export default function ReviewPage() {
return suffix ? `${base}${suffix}` : base;
};
// The seat class/category is chosen once per leg (coach type selected on /booking/seats),
// so every seat on that leg shares it — no need to look it up per-seat.
const formatSeatClass = (schedule: any): string => {
const raw = schedule?.seatClassName;
if (!raw) return '';
return String(raw).replace(/_/g, ' ');
};
useEffect(() => {
const fetchSeatDetails = async () => {
try {