From dd7b471a40901282cb7b9c3d7127ae6aa9630919 Mon Sep 17 00:00:00 2001 From: Bryan Fullam Date: Fri, 20 Dec 2024 13:41:24 -0800 Subject: [PATCH] refactor: only reset bridge state if active quote is not present --- ui/pages/bridge/prepare/prepare-bridge-page.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/pages/bridge/prepare/prepare-bridge-page.tsx b/ui/pages/bridge/prepare/prepare-bridge-page.tsx index e95374104c6b..6083a7d6c2e8 100644 --- a/ui/pages/bridge/prepare/prepare-bridge-page.tsx +++ b/ui/pages/bridge/prepare/prepare-bridge-page.tsx @@ -217,9 +217,6 @@ const PrepareBridgePage = () => { }, [rotateSwitchTokens]); useEffect(() => { - // Reset controller and inputs on load - dispatch(resetBridgeState()); - if (activeQuote) { // Get input data from active quote const { srcAsset, destAsset, destChainId } = activeQuote.quote; @@ -229,6 +226,7 @@ const PrepareBridgePage = () => { if (quoteSrcToken && quoteDestToken && quoteDestChainId) { // Set inputs to values from active quote + dispatch(setFromTokenInputValue(null)); dispatch( setFromToken({ ...quoteSrcToken, image: quoteSrcToken.iconUrl }), ); @@ -237,6 +235,9 @@ const PrepareBridgePage = () => { setToToken({ ...quoteDestToken, image: quoteDestToken.iconUrl }), ); } + } else { + // Reset controller and inputs on load + dispatch(resetBridgeState()); } }, []);