From fe5b258fcae9d7704f40300da57fadc1c29019aa Mon Sep 17 00:00:00 2001 From: Roba Boru Date: Thu, 16 Jul 2026 17:02:23 +0300 Subject: [PATCH] Fix confirmation page pending payment --- .../portal/src/app/booking/confirmation/page.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/edr-passenger-web/portal/src/app/booking/confirmation/page.tsx b/apps/edr-passenger-web/portal/src/app/booking/confirmation/page.tsx index d9253a93e..66a7bf9c3 100644 --- a/apps/edr-passenger-web/portal/src/app/booking/confirmation/page.tsx +++ b/apps/edr-passenger-web/portal/src/app/booking/confirmation/page.tsx @@ -110,6 +110,14 @@ export default function ConfirmationPage() { }; } }, + // 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, }); @@ -123,6 +131,7 @@ export default function ConfirmationPage() { queryKey: ["payment-intent-status", bookingId], queryFn: () => apiClient.get(`/payments/intents/${bookingId}`), enabled: _booking?.status === "PENDING_PAYMENT" && !!bookingId, + staleTime: 0, refetchInterval: () => Date.now() - mountTimeRef.current < CONFIRMATION_GRACE_PERIOD_MS ? FAST_POLL_INTERVAL_MS