From 0de217048ff92ba42d0a3f96438aaf3fc0ad9967 Mon Sep 17 00:00:00 2001 From: tenderdeve Date: Tue, 23 Jun 2026 15:18:22 +0530 Subject: [PATCH] fix(bridge): keep bridge order status polling while tab is hidden SWR config for the cross-chain order hook disabled background refresh (`refreshWhenHidden: false`). As a result, a swap-and-bridge order would stay marked as pending on CoW Swap (and on Explorer) until the tab was focused again, lagging the actual bridge status by 4-5s on each return. Enable `refreshWhenHidden: true` for both the cowswap-frontend and explorer cross-chain order hooks so the bridge status (and the order state derived from it) stays in sync even when the tab is in the background. Polling still stops once the bridge reaches a final status. Closes #6694 --- .../src/entities/bridgeOrders/hooks/useCrossChainOrder.ts | 2 +- apps/explorer/src/modules/bridge/hooks/useCrossChainOrder.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/cowswap-frontend/src/entities/bridgeOrders/hooks/useCrossChainOrder.ts b/apps/cowswap-frontend/src/entities/bridgeOrders/hooks/useCrossChainOrder.ts index f8c3e2bbf8d..cdb40b40deb 100644 --- a/apps/cowswap-frontend/src/entities/bridgeOrders/hooks/useCrossChainOrder.ts +++ b/apps/cowswap-frontend/src/entities/bridgeOrders/hooks/useCrossChainOrder.ts @@ -14,7 +14,7 @@ const swrOptions: SWRConfiguration = { revalidateOnFocus: false, revalidateOnReconnect: false, refreshWhenOffline: false, - refreshWhenHidden: false, + refreshWhenHidden: true, refreshInterval(data) { if (data) { const isBridgingFinished = BRIDGING_FINAL_STATUSES.includes(data.statusResult.status) diff --git a/apps/explorer/src/modules/bridge/hooks/useCrossChainOrder.ts b/apps/explorer/src/modules/bridge/hooks/useCrossChainOrder.ts index f8d04578e9e..95b7d8d8ec9 100644 --- a/apps/explorer/src/modules/bridge/hooks/useCrossChainOrder.ts +++ b/apps/explorer/src/modules/bridge/hooks/useCrossChainOrder.ts @@ -14,6 +14,7 @@ export const BRIDGING_FINAL_STATUSES = [BridgeStatus.EXECUTED, BridgeStatus.EXPI const swrOptions: SWRConfiguration = { ...SWR_NO_REFRESH_OPTIONS, + refreshWhenHidden: true, refreshInterval: (data) => { if (data) { const isBridgingFinished = BRIDGING_FINAL_STATUSES.includes(data.statusResult.status)