diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f5859115..7e009883e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Bump `@adobe/css-tools` from 4.2.0 to 4.3.1 +- Re-renders on `WalletInput` component when programmatically changing its value ## [0.2.12] - 2023-08-23 diff --git a/src/components/input/walletInput.tsx b/src/components/input/walletInput.tsx index 078b4f3b7..91a289e30 100644 --- a/src/components/input/walletInput.tsx +++ b/src/components/input/walletInput.tsx @@ -128,7 +128,6 @@ export const WalletInput = React.forwardRef(() => (value.ensName ? 'ensName' : 'address')); const [initialHeight, setInitialHeight] = useState(0); - const [resolvedValues, setResolvedValues] = useState(); const canToggle = !!value.address && !!value.ensName; const togglerLabel = displayMode === 'address' ? 'ENS' : '0x…'; @@ -206,15 +205,12 @@ export const WalletInput = React.forwardRef { - if (resolvedValues) { - // update the controller value if it is not the same as the resolved values; - // this works in conjunction with the previous hook - const resolvedType = displayMode === 'address' ? 'ensName' : 'address'; - if (value[resolvedType] !== resolvedValues[resolvedType]) { - onValueChange(resolvedValues); - } - } - }, [displayMode, onValueChange, resolvedValues, value]); - // resolve the forwarded ref and local ref useEffect(() => { if (typeof ref === 'function') { @@ -326,8 +311,6 @@ export const WalletInput = React.forwardRef { - setResolvedValues(undefined); - if (addressOrEns === '') { return { ensName: '', address: '' }; }