conflict ifx

This commit is contained in:
mmv 2019-04-16 14:45:39 +04:00
commit d8fbdd393a
3 changed files with 6 additions and 3 deletions

View File

@ -25,6 +25,7 @@ import Spacer from '~/components/Spacer'
import Row from '~/components/layout/Row' import Row from '~/components/layout/Row'
import { ETH_ADDRESS } from '~/logic/tokens/utils/tokenHelpers' import { ETH_ADDRESS } from '~/logic/tokens/utils/tokenHelpers'
import { type Token } from '~/logic/tokens/store/model/token' import { type Token } from '~/logic/tokens/store/model/token'
import { type SafeToken } from '~/routes/safe/store/models/safeToken'
import actions, { type Actions } from './actions' import actions, { type Actions } from './actions'
import TokenPlaceholder from './assets/token_placeholder.png' import TokenPlaceholder from './assets/token_placeholder.png'
import { styles } from './style' import { styles } from './style'
@ -34,6 +35,7 @@ type Props = Actions & {
classes: Object, classes: Object,
tokens: List<Token>, tokens: List<Token>,
safeAddress: string, safeAddress: string,
activeTokens: List<SafeToken>
} }
type State = { type State = {
@ -68,7 +70,7 @@ class Tokens extends React.Component<Props, State> {
onSwitch = (token: Token) => () => { onSwitch = (token: Token) => () => {
const { safeAddress, updateActiveTokens } = this.props const { safeAddress, updateActiveTokens } = this.props
updateActiveTokens(safeAddress, token.address) updateActiveTokens(safeAddress, token)
} }
setImageToPlaceholder = (e) => { setImageToPlaceholder = (e) => {

View File

@ -32,7 +32,7 @@ class SafeView extends React.Component<Props> {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
const { activeTokens } = this.props const { activeTokens } = this.props
if (!activeTokens.equals(prevProps.activeTokens)) { if (activeTokens.size > prevProps.activeTokens.size) {
this.checkForUpdates() this.checkForUpdates()
} }
} }

View File

@ -2,6 +2,7 @@
import { List } from 'immutable' import { List } from 'immutable'
import type { Dispatch as ReduxDispatch, GetState } from 'redux' import type { Dispatch as ReduxDispatch, GetState } from 'redux'
import { type GlobalState } from '~/store' import { type GlobalState } from '~/store'
import { type TokenBalance } from '/routes/safe/store/models/tokenBalance'
import { safeActiveTokensSelector } from '~/routes/safe/store/selectors' import { safeActiveTokensSelector } from '~/routes/safe/store/selectors'
import { SAFE_PARAM_ADDRESS } from '~/routes/routes' import { SAFE_PARAM_ADDRESS } from '~/routes/routes'
import updateSafe from './updateSafe' import updateSafe from './updateSafe'
@ -21,7 +22,7 @@ const updateActiveTokens = (safeAddress: string, tokenAddress: string) => async
getState: GetState<GlobalState>, getState: GetState<GlobalState>,
) => { ) => {
const state = getState() const state = getState()
const safeTokens: List<SafeToken> = safeActiveTokensSelector(state, generateMatchProps(safeAddress)) const safeTokens: List<TokenBalance> = safeActiveTokensSelector(state, generateMatchProps(safeAddress))
const index = safeTokens.findIndex(safeToken => safeToken === tokenAddress) const index = safeTokens.findIndex(safeToken => safeToken === tokenAddress)
let updatedTokens let updatedTokens