From 7a617257931b3460f23f00d07f17763bdcc828ef Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Tue, 6 Aug 2024 18:41:07 -0400 Subject: [PATCH] fix: duplicate change network requests --- .../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;