diff --git a/src/routes/safe/component/Layout.stories.js b/src/routes/safe/component/Layout.stories.js index 86e8f8a5..08bd8423 100644 --- a/src/routes/safe/component/Layout.stories.js +++ b/src/routes/safe/component/Layout.stories.js @@ -1,7 +1,7 @@ // @flow import { storiesOf } from '@storybook/react' import * as React from 'react' -import { Map } from 'immutable' +import { List } from 'immutable' import styles from '~/components/layout/PageFrame/index.scss' import { SafeFactory } from '~/routes/safe/store/test/builder/safe.builder' import { makeToken } from '~/routes/tokens/store/model/token' @@ -30,7 +30,7 @@ storiesOf('Routes /safe:address', module) userAddress="foo" safe={undefined} provider="METAMASK" - activeTokens={Map()} + activeTokens={List([])} fetchBalance={() => {}} /> )) @@ -39,7 +39,7 @@ storiesOf('Routes /safe:address', module) userAddress="foo" safe={undefined} provider="" - activeTokens={Map()} + activeTokens={List([])} fetchBalance={() => {}} /> )) @@ -51,7 +51,7 @@ storiesOf('Routes /safe:address', module) userAddress="foo" safe={safe} provider="METAMASK" - activeTokens={Map().set('ETH', ethBalance)} + activeTokens={List([]).push(ethBalance)} fetchBalance={() => {}} /> ) @@ -64,7 +64,7 @@ storiesOf('Routes /safe:address', module) userAddress="foo" safe={safe} provider="METAMASK" - activeTokens={Map().set('ETH', ethBalance)} + activeTokens={List([]).push(ethBalance)} fetchBalance={() => {}} /> ) diff --git a/src/routes/safe/component/Safe/index.jsx b/src/routes/safe/component/Safe/index.jsx index 232cfee3..f49e69c5 100644 --- a/src/routes/safe/component/Safe/index.jsx +++ b/src/routes/safe/component/Safe/index.jsx @@ -1,7 +1,7 @@ // @flow -import List from '@material-ui/core/List' +import ListComponent from '@material-ui/core/List' import * as React from 'react' -import { Map } from 'immutable' +import { List } from 'immutable' import Block from '~/components/layout/Block' import Col from '~/components/layout/Col' import Bold from '~/components/layout/Bold' @@ -30,7 +30,7 @@ const safeIcon = require('./assets/gnosis_safe.svg') type SafeProps = { safe: Safe, - tokens: Map, + tokens: List, userAddress: string, } @@ -43,12 +43,17 @@ const listStyle = { } const getEthBalanceFrom = (tokens: List) => { - const ethToken = tokens.filter(token => token.get('symbol') === 'ETH') - if (ethToken.count() === 0) { + const filteredTokens = tokens.filter(token => token.get('symbol') === 'ETH') + if (filteredTokens.count() === 0) { return 0 } - return Number(ethToken.get(0).get('funds')) + const ethToken = filteredTokens.get(0) + if (!ethToken) { + return 0 + } + + return Number(ethToken.get('funds')) } class GnoSafe extends React.PureComponent { @@ -115,7 +120,7 @@ class GnoSafe extends React.PureComponent { return ( - + {
- + diff --git a/src/routes/safe/container/selector.js b/src/routes/safe/container/selector.js index 94b76a07..fe1f8997 100644 --- a/src/routes/safe/container/selector.js +++ b/src/routes/safe/container/selector.js @@ -1,5 +1,5 @@ // @flow -import { List, Map } from 'immutable' +import { List } from 'immutable' import { createSelector, createStructuredSelector, type Selector } from 'reselect' import { safeSelector, type RouterProps, type SafeSelectorProps } from '~/routes/safe/store/selectors' import { providerNameSelector, userAccountSelector } from '~/wallets/store/selectors/index' @@ -13,7 +13,7 @@ import { type Token } from '~/routes/tokens/store/model/token' export type SelectorProps = { safe: SafeSelectorProps, provider: string, - activeTokens: Map, + activeTokens: List, userAddress: string, } diff --git a/src/routes/tokens/container/selector.js b/src/routes/tokens/container/selector.js index dd490988..1865d4e1 100644 --- a/src/routes/tokens/container/selector.js +++ b/src/routes/tokens/container/selector.js @@ -8,7 +8,7 @@ import { type Token } from '~/routes/tokens/store/model/token' export type SelectorProps = { tokens: List, - addresses: List, + addresses: List, safe: Safe, safeAddress: string, }