Fix confirmation page pending payment

This commit is contained in:
Roba Boru
2026-07-16 17:02:23 +03:00
parent bc8571cbd2
commit fe5b258fca

View File

@@ -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