Fix - Owners list error (#1127)

* Add validation for addressBooj

* Fix types

* Update default value

* Update src/logic/addressBook/utils/index.ts

Co-authored-by: Fernando <fernando.greco@gmail.com>

Co-authored-by: Mati Dastugue <mdastugu@amazon.com>
Co-authored-by: Mikhail Mikheev <mmvsha73@gmail.com>
Co-authored-by: Fernando <fernando.greco@gmail.com>
This commit is contained in:
Mati Dastugue 2020-07-28 08:25:26 -03:00 committed by GitHub
parent 91a85ae9ea
commit 8a6b219781
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -12,7 +12,7 @@ export const getAddressBook = createSelector(
(addressBook, safeAddress) => { (addressBook, safeAddress) => {
let result = Map([]) let result = Map([])
if (addressBook) { if (addressBook) {
result = addressBook.get(safeAddress) result = addressBook.get(safeAddress, List([]))
} }
return result return result
}, },

View File

@ -1,5 +1,7 @@
import { List } from 'immutable'
import { loadFromStorage, saveToStorage } from 'src/utils/storage' import { loadFromStorage, saveToStorage } from 'src/utils/storage'
import { AddressBookEntryProps } from './../model/addressBook' import { AddressBookEntryProps } from './../model/addressBook'
import { SafeOwner } from 'src/routes/safe/store/models/safe'
const ADDRESS_BOOK_STORAGE_KEY = 'ADDRESS_BOOK_STORAGE_KEY' const ADDRESS_BOOK_STORAGE_KEY = 'ADDRESS_BOOK_STORAGE_KEY'
@ -27,7 +29,10 @@ export const getNameFromAdbk = (addressBook, userAddress) => {
return null return null
} }
export const getOwnersWithNameFromAddressBook = (addressBook, ownerList) => { export const getOwnersWithNameFromAddressBook = (
addressBook: AddressBookEntryProps,
ownerList: List<SafeOwner>,
): List<SafeOwner> | [] => {
if (!ownerList) { if (!ownerList) {
return [] return []
} }