fix "cannot read `size` of undefined" error message

This commit is contained in:
fernandomg 2020-07-17 10:56:45 -03:00
parent eab41bd314
commit d483f1ff16
2 changed files with 4 additions and 2 deletions

View File

@ -5,7 +5,9 @@ import { ModulePair } from 'src/routes/safe/store/models/safe'
export const MODULES_TABLE_ADDRESS_ID = 'address' export const MODULES_TABLE_ADDRESS_ID = 'address'
export const MODULES_TABLE_ACTIONS_ID = 'actions' export const MODULES_TABLE_ACTIONS_ID = 'actions'
export const getModuleData = (modulesList: List<ModulePair>): List<{ [MODULES_TABLE_ADDRESS_ID]: ModulePair }> => { export const getModuleData = (
modulesList: List<ModulePair> | null,
): List<{ [MODULES_TABLE_ADDRESS_ID]: ModulePair }> | undefined => {
return modulesList?.map((modules) => ({ return modulesList?.map((modules) => ({
[MODULES_TABLE_ADDRESS_ID]: modules, [MODULES_TABLE_ADDRESS_ID]: modules,
})) }))

View File

@ -82,7 +82,7 @@ const Advanced = (): React.ReactElement => {
const nonce = useSelector(safeNonceSelector) const nonce = useSelector(safeNonceSelector)
const granted = useSelector(grantedSelector) const granted = useSelector(grantedSelector)
const modules = useSelector(safeModulesSelector) const modules = useSelector(safeModulesSelector)
const moduleData = modules ?? getModuleData(modules) const moduleData = getModuleData(modules) ?? modules
const [viewRemoveModuleModal, setViewRemoveModuleModal] = React.useState(false) const [viewRemoveModuleModal, setViewRemoveModuleModal] = React.useState(false)
const hideRemoveModuleModal = () => setViewRemoveModuleModal(false) const hideRemoveModuleModal = () => setViewRemoveModuleModal(false)