Skip to content

Commit

Permalink
fix - removed update language in layout (performance issues)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyncee59 committed Jun 19, 2018
1 parent 2230af3 commit cc904fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 deletions.
Expand Up @@ -3,7 +3,6 @@ import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { Route, Redirect } from 'react-router-dom'

import { Remote } from 'blockchain-wallet-v4/src'
import { actions, selectors } from 'data'
import WalletLayout from './template'

Expand All @@ -15,16 +14,6 @@ class WalletLayoutContainer extends React.PureComponent {
this.props.kvStoreBuySellActions.fetchMetadataBuySell()
}

// Language must also be set on settings (wallet get-info)
// if it differs from language preferences (local storage)
componentDidUpdate (prevProps) {
if (!Remote.Success.is(prevProps.payloadLanguage) && Remote.Success.is(this.props.payloadLanguage)) {
if (this.props.language !== this.props.payloadLanguage.getOrElse()) {
this.props.moduleSettingsActions.updateLanguage(this.props.language)
}
}
}

render () {
const { isAuthenticated, path, computedMatch, component: Component } = this.props

Expand All @@ -40,17 +29,14 @@ class WalletLayoutContainer extends React.PureComponent {

const mapStateToProps = (state) => ({
language: selectors.preferences.getLanguage(state),
isAuthenticated: selectors.auth.isAuthenticated(state),
payloadLanguage: selectors.core.settings.getLanguage(state)
isAuthenticated: selectors.auth.isAuthenticated(state)
})

const mapDispatchToProps = (dispatch) => ({
kvStoreShapeshiftActions: bindActionCreators(actions.core.kvStore.shapeShift, dispatch),
kvStoreEthereumActions: bindActionCreators(actions.core.kvStore.ethereum, dispatch),
kvStoreWhatsNewActions: bindActionCreators(actions.core.kvStore.whatsNew, dispatch),
kvStoreBuySellActions: bindActionCreators(actions.core.kvStore.buySell, dispatch),
moduleSettingsActions: bindActionCreators(actions.modules.settings, dispatch),
optionsActions: bindActionCreators(actions.core.walletOptions, dispatch),
settingsActions: bindActionCreators(actions.core.settings, dispatch)
})

Expand Down
10 changes: 5 additions & 5 deletions packages/blockchain-wallet-v4-frontend/src/scenes/Home/index.js
Expand Up @@ -7,7 +7,7 @@ import { selectors } from 'data'
import ActivityList from './ActivityList'
import DidYouKnow from './DidYouKnow'
import PriceChart from './PriceChart'
import BalancesChartContainer from './BalancesChart'
import BalancesChart from './BalancesChart'
import SfoxSignupBanner from './SfoxSignupBanner'
import ErrorBoundary from 'providers/ErrorBoundaryProvider'

Expand Down Expand Up @@ -61,12 +61,12 @@ class Home extends React.PureComponent {
{ buySellKv.cata({ Success: () => <SfoxSignupBanner/>, Failure: () => <div/>, Loading: () => <div/>, NotAsked: () => <div/> }) }
<ColumnWrapper>
<ColumnLeft>
<BalancesChartContainer/>
<ActivityList/>
<BalancesChart />
<ActivityList />
</ColumnLeft>
<ColumnRight>
<PriceChart/>
<DidYouKnow/>
<PriceChart />
<DidYouKnow />
</ColumnRight>
</ColumnWrapper>
</Wrapper>
Expand Down

0 comments on commit cc904fb

Please sign in to comment.