diff --git a/packages/synapse-interface/pages/state-managed-bridge/index.tsx b/packages/synapse-interface/pages/state-managed-bridge/index.tsx index 739c77333c..877844e262 100644 --- a/packages/synapse-interface/pages/state-managed-bridge/index.tsx +++ b/packages/synapse-interface/pages/state-managed-bridge/index.tsx @@ -75,6 +75,7 @@ import { useStaleQuoteUpdater } from '@/utils/hooks/useStaleQuoteUpdater' import { convertUuidToUnix } from '@/utils/convertUuidToUnix' const StateManagedBridge = () => { + const dispatch = useAppDispatch() const { address } = useAccount() const { synapseSDK } = useSynapseContext() const router = useRouter() @@ -83,6 +84,7 @@ const StateManagedBridge = () => { const bridgeDisplayRef = useRef(null) const currentSDKRequestID = useRef(0) const quoteToastRef = useRef({ id: '' }) + const quoteTimeout = 15000 const { fromChainId, @@ -95,14 +97,13 @@ const StateManagedBridge = () => { isLoading: isQuoteLoading, isWalletPending, }: BridgeState = useBridgeState() - const { showSettingsSlideOver, showDestinationAddress } = useSelector( + + const { showSettingsSlideOver } = useSelector( (state: RootState) => state.bridgeDisplay ) const [isApproved, setIsApproved] = useState(false) - const dispatch = useAppDispatch() - useEffect(() => { segmentAnalyticsEvent(`[Bridge page] arrives`, { fromChainId, @@ -327,7 +328,8 @@ const StateManagedBridge = () => { bridgeQuote, getAndSetBridgeQuote, isQuoteLoading, - isWalletPending + isWalletPending, + quoteTimeout ) const approveTxn = async () => { @@ -359,7 +361,7 @@ const StateManagedBridge = () => { bridgeQuoteTimestamp ) - if (timeDifference > 15000) { + if (timeDifference > quoteTimeout) { await getAndSetBridgeQuote() } diff --git a/packages/synapse-interface/utils/hooks/useStaleQuoteUpdater.ts b/packages/synapse-interface/utils/hooks/useStaleQuoteUpdater.ts index 5cec72cef6..05ccd37dc3 100644 --- a/packages/synapse-interface/utils/hooks/useStaleQuoteUpdater.ts +++ b/packages/synapse-interface/utils/hooks/useStaleQuoteUpdater.ts @@ -1,4 +1,4 @@ -import { isEmpty, isNull, isNumber, isUndefined } from 'lodash' +import { isNull, isNumber } from 'lodash' import { useEffect, useRef } from 'react' import { BridgeQuote } from '@/utils/types' @@ -15,7 +15,7 @@ export const useStaleQuoteUpdater = ( refreshQuoteCallback: () => Promise, isQuoteLoading: boolean, isWalletPending: boolean, - staleTimeout: number = 15000 // 15_000ms or 15s + staleTimeout: number = 15000 // Default 15_000ms or 15s ) => { const eventListenerRef = useRef void)>(null)