Fix load safe tokens when safe is in store before v3.5.0

This commit is contained in:
Daniel Sanchez 2021-04-26 17:37:27 +02:00
parent 3499b7bb87
commit 86d8fe3a51
1 changed files with 21 additions and 13 deletions

View File

@ -1,3 +1,4 @@
import * as Sentry from '@sentry/react'
import { List } from 'immutable' import { List } from 'immutable'
import { createSelector } from 'reselect' import { createSelector } from 'reselect'
@ -31,6 +32,7 @@ export const extendedSafeTokensSelector = createSelector(
(safeBalances, tokensList, ethAsToken): List<Token> => { (safeBalances, tokensList, ethAsToken): List<Token> => {
const extendedTokens: Array<Token> = [] const extendedTokens: Array<Token> = []
try {
safeBalances.forEach((safeBalance) => { safeBalances.forEach((safeBalance) => {
const tokenAddress = safeBalance.tokenAddress const tokenAddress = safeBalance.tokenAddress
@ -49,6 +51,12 @@ export const extendedSafeTokensSelector = createSelector(
}) })
return List(extendedTokens) return List(extendedTokens)
} catch (e) {
Sentry.captureMessage(
'There was an error loading `safeBalances` in `extendedSafeTokensSelector`, probably safe loaded prior to v3.5.0',
)
return List([])
}
}, },
) )