Skip to content

Commit

Permalink
refactor: only reset bridge state if active quote is not present
Browse files Browse the repository at this point in the history
  • Loading branch information
bfullam committed Dec 20, 2024
1 parent ee39ed1 commit dd7b471
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ui/pages/bridge/prepare/prepare-bridge-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 }),
);
Expand All @@ -237,6 +235,9 @@ const PrepareBridgePage = () => {
setToToken({ ...quoteDestToken, image: quoteDestToken.iconUrl }),
);
}
} else {
// Reset controller and inputs on load
dispatch(resetBridgeState());
}
}, []);

Expand Down

0 comments on commit dd7b471

Please sign in to comment.