diff --git a/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.tsx b/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.tsx index 901a8ea6d4..f4d8b65c13 100644 --- a/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.tsx +++ b/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/EditBuyAmount/SelectBuyTokenFromListScreen/SelectBuyTokenFromListScreen.tsx @@ -137,6 +137,7 @@ const SelectableToken = ({wallet, tokenInfo, walletTokenIds}: SelectableTokenPro const {buyTokenInfoChanged, orderData} = useSwap() const { sellQuantity: {isTouched: isSellTouched}, + buyQuantity: {isTouched: isBuyTouched}, buyTouched, } = useSwapForm() const navigateTo = useNavigateTo() @@ -144,13 +145,13 @@ const SelectableToken = ({wallet, tokenInfo, walletTokenIds}: SelectableTokenPro const isDisabled = id === orderData.amounts.sell.tokenId && isSellTouched const inUserWallet = walletTokenIds.includes(tokenInfo.id) - const isSameToken = id === orderData.amounts.buy.tokenId + const shouldUpdateToken = id !== orderData.amounts.buy.tokenId || !isBuyTouched const handleOnTokenSelection = () => { track.swapAssetToChanged({ to_asset: [{asset_name: name, asset_ticker: ticker, policy_id: group}], }) - if (!isSameToken) { + if (shouldUpdateToken) { buyTokenInfoChanged({ decimals: decimals ?? 0, id: id, diff --git a/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.tsx b/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.tsx index e0d14aa49a..482bce4ad6 100644 --- a/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.tsx +++ b/apps/wallet-mobile/src/features/Swap/useCases/StartSwapScreen/CreateOrder/EditSellAmount/SelectSellTokenFromListScreen/SelectSellTokenFromListScreen.tsx @@ -91,6 +91,7 @@ const SelectableToken = ({tokenInfo, wallet}: SelectableTokenProps) => { const {sellTokenInfoChanged, orderData} = useSwap() const { buyQuantity: {isTouched: isBuyTouched}, + sellQuantity: {isTouched: isSellTouched}, sellTouched, } = useSwapForm() const navigateTo = useNavigateTo() @@ -98,13 +99,13 @@ const SelectableToken = ({tokenInfo, wallet}: SelectableTokenProps) => { const balanceAvailable = useBalance({wallet, tokenId: tokenInfo.id}) const isDisabled = tokenInfo.id === orderData.amounts.buy.tokenId && isBuyTouched - const isSameToken = tokenInfo.id === orderData.amounts.sell.tokenId + const shouldUpdateToken = tokenInfo.id !== orderData.amounts.sell.tokenId || !isSellTouched const handleOnTokenSelection = () => { track.swapAssetFromChanged({ from_asset: [{asset_name: tokenInfo.name, asset_ticker: tokenInfo.ticker, policy_id: tokenInfo.group}], }) - if (!isSameToken) { + if (shouldUpdateToken) { sellTouched() sellTokenInfoChanged({ id: tokenInfo.id,