From d483f1ff1660ea338dbc3f9f98170f6d5ce92e36 Mon Sep 17 00:00:00 2001 From: fernandomg Date: Fri, 17 Jul 2020 10:56:45 -0300 Subject: [PATCH] fix "cannot read `size` of undefined" error message --- src/routes/safe/components/Settings/Advanced/dataFetcher.ts | 4 +++- src/routes/safe/components/Settings/Advanced/index.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routes/safe/components/Settings/Advanced/dataFetcher.ts b/src/routes/safe/components/Settings/Advanced/dataFetcher.ts index 08483f68..e36dd8f5 100644 --- a/src/routes/safe/components/Settings/Advanced/dataFetcher.ts +++ b/src/routes/safe/components/Settings/Advanced/dataFetcher.ts @@ -5,7 +5,9 @@ import { ModulePair } from 'src/routes/safe/store/models/safe' export const MODULES_TABLE_ADDRESS_ID = 'address' export const MODULES_TABLE_ACTIONS_ID = 'actions' -export const getModuleData = (modulesList: List): List<{ [MODULES_TABLE_ADDRESS_ID]: ModulePair }> => { +export const getModuleData = ( + modulesList: List | null, +): List<{ [MODULES_TABLE_ADDRESS_ID]: ModulePair }> | undefined => { return modulesList?.map((modules) => ({ [MODULES_TABLE_ADDRESS_ID]: modules, })) diff --git a/src/routes/safe/components/Settings/Advanced/index.tsx b/src/routes/safe/components/Settings/Advanced/index.tsx index e9a6414e..a684da73 100644 --- a/src/routes/safe/components/Settings/Advanced/index.tsx +++ b/src/routes/safe/components/Settings/Advanced/index.tsx @@ -82,7 +82,7 @@ const Advanced = (): React.ReactElement => { const nonce = useSelector(safeNonceSelector) const granted = useSelector(grantedSelector) const modules = useSelector(safeModulesSelector) - const moduleData = modules ?? getModuleData(modules) + const moduleData = getModuleData(modules) ?? modules const [viewRemoveModuleModal, setViewRemoveModuleModal] = React.useState(false) const hideRemoveModuleModal = () => setViewRemoveModuleModal(false)