From 41bccf35aeb418d3b2d78d3e0bfeabb15afbb3e7 Mon Sep 17 00:00:00 2001 From: toniocodo Date: Fri, 29 Sep 2023 18:10:57 +0200 Subject: [PATCH] fix: ens name in AccountLabel, check amount on update --- libs/oeth/swap/src/hooks.ts | 6 ++++-- .../providers/src/wagmi/components/AddressLabel.tsx | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/oeth/swap/src/hooks.ts b/libs/oeth/swap/src/hooks.ts index 2508f7ac7..97287999e 100644 --- a/libs/oeth/swap/src/hooks.ts +++ b/libs/oeth/swap/src/hooks.ts @@ -22,8 +22,10 @@ export const useHandleAmountInChange = () => { (amount: bigint) => { setSwapState( produce((state) => { - state.amountIn = amount; - state.isSwapRoutesLoading = amount !== 0n; + if (state.amountIn !== amount) { + state.amountIn = amount; + state.isSwapRoutesLoading = amount !== 0n; + } }), ); }, diff --git a/libs/shared/providers/src/wagmi/components/AddressLabel.tsx b/libs/shared/providers/src/wagmi/components/AddressLabel.tsx index 05d0c79b3..26900dd47 100644 --- a/libs/shared/providers/src/wagmi/components/AddressLabel.tsx +++ b/libs/shared/providers/src/wagmi/components/AddressLabel.tsx @@ -26,12 +26,6 @@ export const AddressLabel = ({ chainId: mainnet.id, }); - if (short) { - return ( - {middleTruncate(address)} - ); - } - if (enableEnsName) { return isEnsNameLoading ? ( @@ -42,5 +36,11 @@ export const AddressLabel = ({ ); } + if (short) { + return ( + {middleTruncate(address)} + ); + } + return {address}; };