Commit ae50d269 authored by Noah Zinsmeister's avatar Noah Zinsmeister Committed by GitHub

fix ens stuff again (#407)

parent 9a1b4345
...@@ -96,6 +96,7 @@ export default function AddressInputPanel({ title, initialInput = '', onChange = ...@@ -96,6 +96,7 @@ export default function AddressInputPanel({ title, initialInput = '', onChange =
let stale = false let stale = false
if (isAddress(debouncedInput)) { if (isAddress(debouncedInput)) {
try {
library library
.lookupAddress(debouncedInput) .lookupAddress(debouncedInput)
.then(name => { .then(name => {
...@@ -110,11 +111,18 @@ export default function AddressInputPanel({ title, initialInput = '', onChange = ...@@ -110,11 +111,18 @@ export default function AddressInputPanel({ title, initialInput = '', onChange =
} }
}) })
.catch(() => { .catch(() => {
if (!stale) {
setData({ address: debouncedInput, name: '' }) setData({ address: debouncedInput, name: '' })
setError(null) setError(null)
}
}) })
} catch {
setData({ address: debouncedInput, name: '' })
setError(null)
}
} else { } else {
if (debouncedInput !== '') { if (debouncedInput !== '') {
try {
library library
.resolveName(debouncedInput) .resolveName(debouncedInput)
.then(address => { .then(address => {
...@@ -129,8 +137,13 @@ export default function AddressInputPanel({ title, initialInput = '', onChange = ...@@ -129,8 +137,13 @@ export default function AddressInputPanel({ title, initialInput = '', onChange =
} }
}) })
.catch(() => { .catch(() => {
if (!stale) {
setError(true) setError(true)
}
}) })
} catch {
setError(true)
}
} }
} }
......
...@@ -69,10 +69,8 @@ export function useENSName(address) { ...@@ -69,10 +69,8 @@ export function useENSName(address) {
} }
}) })
} catch { } catch {
if (!stale) {
setENSNname(null) setENSNname(null)
} }
}
return () => { return () => {
stale = true stale = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment