mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-07 23:35:42 +00:00
Fix confirmation page pending payment
This commit is contained in:
@@ -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,
|
enabled: !!bookingId,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -123,6 +131,7 @@ export default function ConfirmationPage() {
|
|||||||
queryKey: ["payment-intent-status", bookingId],
|
queryKey: ["payment-intent-status", bookingId],
|
||||||
queryFn: () => apiClient.get(`/payments/intents/${bookingId}`),
|
queryFn: () => apiClient.get(`/payments/intents/${bookingId}`),
|
||||||
enabled: _booking?.status === "PENDING_PAYMENT" && !!bookingId,
|
enabled: _booking?.status === "PENDING_PAYMENT" && !!bookingId,
|
||||||
|
staleTime: 0,
|
||||||
refetchInterval: () =>
|
refetchInterval: () =>
|
||||||
Date.now() - mountTimeRef.current < CONFIRMATION_GRACE_PERIOD_MS
|
Date.now() - mountTimeRef.current < CONFIRMATION_GRACE_PERIOD_MS
|
||||||
? FAST_POLL_INTERVAL_MS
|
? FAST_POLL_INTERVAL_MS
|
||||||
|
|||||||
Reference in New Issue
Block a user