mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Return Promise from removeFromAddressBook
thunk (#8451)
`removeFromAddressBook` returned a thunk that didn't return a Promise, despite doing async work. It now returns a Promise. The callers were updated to `await` the completion of this operation.
This commit is contained in:
parent
e20ca4668e
commit
7302a14341
@ -49,8 +49,8 @@ export default class EditContact extends PureComponent {
|
||||
<Button
|
||||
type="link"
|
||||
className="settings-page__address-book-button"
|
||||
onClick={() => {
|
||||
removeFromAddressBook(chainId, address)
|
||||
onClick={async () => {
|
||||
await removeFromAddressBook(chainId, address)
|
||||
history.push(listRoute)
|
||||
}}
|
||||
>
|
||||
@ -115,7 +115,7 @@ export default class EditContact extends PureComponent {
|
||||
if (this.state.newAddress !== '' && this.state.newAddress !== address) {
|
||||
// if the user makes a valid change to the address field, remove the original address
|
||||
if (isValidAddress(this.state.newAddress)) {
|
||||
removeFromAddressBook(chainId, address)
|
||||
await removeFromAddressBook(chainId, address)
|
||||
await addToAddressBook(this.state.newAddress, this.state.newName || name, this.state.newMemo || memo)
|
||||
setAccountLabel(this.state.newAddress, this.state.newName || name)
|
||||
history.push(listRoute)
|
||||
|
@ -1551,8 +1551,8 @@ export function addToAddressBook (recipient, nickname = '', memo = '') {
|
||||
export function removeFromAddressBook (chainId, addressToRemove) {
|
||||
log.debug(`background.removeFromAddressBook`)
|
||||
|
||||
return () => {
|
||||
background.removeFromAddressBook(chainId, checksumAddress(addressToRemove))
|
||||
return async () => {
|
||||
await promisifiedBackground.removeFromAddressBook(chainId, checksumAddress(addressToRemove))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user