diff --git a/ui/app/pages/send/send-content/add-recipient/ens-input.component.js b/ui/app/pages/send/send-content/add-recipient/ens-input.component.js index ccbfed356..acd953116 100644 --- a/ui/app/pages/send/send-content/add-recipient/ens-input.component.js +++ b/ui/app/pages/send/send-content/add-recipient/ens-input.component.js @@ -33,6 +33,7 @@ export default class EnsInput extends Component { onReset: PropTypes.func, onValidAddressTyped: PropTypes.func, contact: PropTypes.object, + value: PropTypes.string, } state = { @@ -53,16 +54,22 @@ export default class EnsInput extends Component { } } - // If an address is sent without a nickname, meaning not from ENS or from - // the user's own accounts, a default of a one-space string is used. componentDidUpdate (prevProps) { const { input, } = this.state const { network, + value, } = this.props + // Update the value in state if its prop value changes + if (input !== value) { + this.setState({ input: value }) + } + + // If an address is sent without a nickname, meaning not from ENS or from + // the user's own accounts, a default of a one-space string is used. if (prevProps.network !== network) { const provider = global.ethereumProvider this.ens = new ENS({ provider, network }) diff --git a/ui/app/pages/settings/contact-list-tab/add-contact/add-contact.component.js b/ui/app/pages/settings/contact-list-tab/add-contact/add-contact.component.js index 12f420186..632ad1b4e 100644 --- a/ui/app/pages/settings/contact-list-tab/add-contact/add-contact.component.js +++ b/ui/app/pages/settings/contact-list-tab/add-contact/add-contact.component.js @@ -52,6 +52,7 @@ export default class AddContact extends PureComponent { validate = (address) => { const valid = isValidAddress(address) const validEnsAddress = isValidDomainName(address) + if (valid || validEnsAddress || address === '') { this.setState({ error: '', ethAddress: address }) } else { @@ -73,6 +74,7 @@ export default class AddContact extends PureComponent { this.setState({ ensAddress: address, error: '', ensError: '' }) }} updateEnsResolutionError={(message) => this.setState({ ensError: message })} + value={this.state.ethAddress || ''} /> ) }