From eef92d0d5a0a1d2ea910194d5e94fbdb70148132 Mon Sep 17 00:00:00 2001 From: Brad Decker Date: Tue, 2 Mar 2021 18:20:37 -0600 Subject: [PATCH] handle undefined network (#10560) --- .../add-recipient/ens-input.component.js | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) 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 a0977406e..f984f13d8 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 @@ -72,10 +72,19 @@ export default class EnsInput extends Component { } if (prevProps.network !== network) { - const provider = global.ethereumProvider; - this.ens = new ENS({ provider, network }); - if (!newProvidedValue) { - newValue = input; + if (getNetworkEnsSupport(network)) { + const provider = global.ethereumProvider; + this.ens = new ENS({ provider, network }); + this.checkName = debounce(this.lookupEnsName, 200); + if (!newProvidedValue) { + newValue = input; + } + } else { + // ens is null on mount on a network that does not have ens support + // this is intended to prevent accidental lookup of domains across + // networks + this.ens = null; + this.checkName = null; } }