Skip to content

Commit

Permalink
(Deposit/Withdraw) Fix Duplicate change network requests (#3688)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseRFelix authored Aug 6, 2024
1 parent ee12007 commit e59fe52
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions packages/web/components/bridge/amount-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,8 +571,10 @@ export const AmountScreen = observer(
) {
const firstChain = supportedChains[0];
setChain(firstChain);
checkChainAndConnectWallet(firstChain);
}
}, [
checkChainAndConnectWallet,
direction,
fromChain,
isLoadingSupportedAssets,
Expand All @@ -593,24 +595,6 @@ export const AmountScreen = observer(
);
}, [direction, canonicalAsset, assetsInOsmosis, toAsset?.address]);

/**
* Only check the chain and connect the wallet if the quote is enabled,
* the asset transfers are not disabled, and the chain is set.
*/
useEffect(() => {
const chain = direction === "deposit" ? fromChain : toChain;
if (chain && quote.enabled && !areAssetTransfersDisabled) {
checkChainAndConnectWallet(chain);
}
}, [
checkChainAndConnectWallet,
direction,
fromChain,
areAssetTransfersDisabled,
quote.enabled,
toChain,
]);

const onChangeCryptoInput = useCallback(
(amount: string) => {
if (isNil(fromAsset?.decimals)) return;
Expand Down

0 comments on commit e59fe52

Please sign in to comment.