From 81f8989c28f03023d231e3a2017212f7d04ff1c3 Mon Sep 17 00:00:00 2001 From: Dong-Ha Kim Date: Thu, 12 Oct 2023 09:56:08 +0200 Subject: [PATCH] fix(bridge): initial quote time issue (#866) --- src/views/Bridge/hooks/useBridgeAction.ts | 2 +- src/views/Bridge/hooks/useTransferQuote.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/views/Bridge/hooks/useBridgeAction.ts b/src/views/Bridge/hooks/useBridgeAction.ts index edac8ce0a..05be8b043 100644 --- a/src/views/Bridge/hooks/useBridgeAction.ts +++ b/src/views/Bridge/hooks/useBridgeAction.ts @@ -67,7 +67,7 @@ export function useBridgeAction( !frozenTokenPrice || !tokenSymbol ) { - return; + throw new Error("Missing required data for bridge action"); } if (isWrongNetwork) { diff --git a/src/views/Bridge/hooks/useTransferQuote.ts b/src/views/Bridge/hooks/useTransferQuote.ts index bbce0ae34..be997a2e3 100644 --- a/src/views/Bridge/hooks/useTransferQuote.ts +++ b/src/views/Bridge/hooks/useTransferQuote.ts @@ -86,14 +86,16 @@ export function useTransferQuote( toAddress ); + let initialQuoteTimeToUse = initialQuoteTime || Date.now(); + if (!initialQuoteTime) { - setInitialQuoteTime((s) => s ?? Date.now()); + setInitialQuoteTime((s) => s ?? initialQuoteTimeToUse); } return { estimatedTime, quote, - initialQuoteTime, + initialQuoteTime: initialQuoteTimeToUse, quotedFees: feesQuery.fees, quotedLimits: limitsQuery.limits, quotePriceUSD: usdPriceQuery.data.price,