From e59fe520aa49848cc83d83e0ecc8be8d51a83f35 Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Tue, 6 Aug 2024 18:49:23 -0400 Subject: [PATCH] (Deposit/Withdraw) Fix Duplicate change network requests (#3688) --- .../web/components/bridge/amount-screen.tsx | 20 ++----------------- 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/packages/web/components/bridge/amount-screen.tsx b/packages/web/components/bridge/amount-screen.tsx index 7cb9341883..f34fa435f0 100644 --- a/packages/web/components/bridge/amount-screen.tsx +++ b/packages/web/components/bridge/amount-screen.tsx @@ -571,8 +571,10 @@ export const AmountScreen = observer( ) { const firstChain = supportedChains[0]; setChain(firstChain); + checkChainAndConnectWallet(firstChain); } }, [ + checkChainAndConnectWallet, direction, fromChain, isLoadingSupportedAssets, @@ -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;