(BugFix) Add guard type for modules (#1124)
* Add guards for modules * Add guards for modules * Update src/routes/safe/store/actions/fetchSafe.ts Co-authored-by: Fernando <fernando.greco@gmail.com> Co-authored-by: Fernando <fernando.greco@gmail.com>
This commit is contained in:
parent
57248c6985
commit
6ba98f4e8a
|
@ -39,8 +39,8 @@ const buildOwnersFrom = (
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
const buildModulesLinkedList = (modules: string[], nextModule: string): Array<ModulePair> | null => {
|
const buildModulesLinkedList = (modules: string[] | undefined, nextModule: string): Array<ModulePair> | null => {
|
||||||
if (modules.length) {
|
if (modules?.length) {
|
||||||
return modules.map((moduleAddress, index, modules) => {
|
return modules.map((moduleAddress, index, modules) => {
|
||||||
const prevModule = modules[index + 1]
|
const prevModule = modules[index + 1]
|
||||||
return [moduleAddress, prevModule !== undefined ? prevModule : nextModule]
|
return [moduleAddress, prevModule !== undefined ? prevModule : nextModule]
|
||||||
|
@ -111,7 +111,7 @@ export const checkAndUpdateSafe = (safeAdd: string) => async (dispatch: Dispatch
|
||||||
dispatch(
|
dispatch(
|
||||||
addSafeModules({
|
addSafeModules({
|
||||||
safeAddress,
|
safeAddress,
|
||||||
modulesAddresses: buildModulesLinkedList(modules.array, modules.next),
|
modulesAddresses: buildModulesLinkedList(modules?.array, modules?.next),
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue