[Address Book v2] - Avoid deleting addressBook entry when deleting a safe (#2374)

* avoid deleting addressBook entry when deleting a safe

* avoid deleting addressBook entry when deleting a safe
This commit is contained in:
Fernando 2021-06-02 10:55:13 -03:00 committed by GitHub
parent 9242d80079
commit 5bc38ff09e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 3 deletions

View File

@ -11,7 +11,6 @@ import Block from 'src/components/layout/Block'
import Hairline from 'src/components/layout/Hairline' import Hairline from 'src/components/layout/Hairline'
import Paragraph from 'src/components/layout/Paragraph' import Paragraph from 'src/components/layout/Paragraph'
import Row from 'src/components/layout/Row' import Row from 'src/components/layout/Row'
import { addressBookRemove } from 'src/logic/addressBook/store/actions'
import { addressBookMapSelector } from 'src/logic/addressBook/store/selectors' import { addressBookMapSelector } from 'src/logic/addressBook/store/selectors'
import { defaultSafeSelector, safeParamAddressFromStateSelector } from 'src/logic/safe/store/selectors' import { defaultSafeSelector, safeParamAddressFromStateSelector } from 'src/logic/safe/store/selectors'
import { WELCOME_ADDRESS } from 'src/routes/routes' import { WELCOME_ADDRESS } from 'src/routes/routes'
@ -41,8 +40,7 @@ export const RemoveSafeModal = ({ isOpen, onClose }: RemoveSafeModalProps): Reac
const onRemoveSafeHandler = async () => { const onRemoveSafeHandler = async () => {
// ToDo: review if this is necessary or we should directly use the `removeSafe` action. // ToDo: review if this is necessary or we should directly use the `removeSafe` action.
await dispatch(removeLocalSafe(safeAddress)) await dispatch(removeLocalSafe(safeAddress))
// remove safe from the address book
safeAddressBookEntry && dispatch(addressBookRemove(safeAddressBookEntry))
if (sameAddress(safeAddress, defaultSafe)) { if (sameAddress(safeAddress, defaultSafe)) {
await saveDefaultSafe('') await saveDefaultSafe('')
} }