Browse Source

This react-router thing is becoming ridiculous

master
meriadec 7 years ago
parent
commit
d4f2ebe96b
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 16
      src/components/SideBar/index.js

16
src/components/SideBar/index.js

@ -4,6 +4,7 @@ import React, { PureComponent, Fragment } from 'react'
import { compose } from 'redux' import { compose } from 'redux'
import { translate } from 'react-i18next' import { translate } from 'react-i18next'
import styled from 'styled-components' import styled from 'styled-components'
import { withRouter } from 'react-router'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import { getCryptoCurrencyIcon } from '@ledgerhq/live-common/lib/react' import { getCryptoCurrencyIcon } from '@ledgerhq/live-common/lib/react'
import type { Account } from '@ledgerhq/live-common/lib/types' import type { Account } from '@ledgerhq/live-common/lib/types'
@ -124,9 +125,17 @@ class SideBar extends PureComponent<Props> {
} }
} }
const AccountsList = connect(state => ({ const AccountsList = compose(
accounts: accountsSelector(state), withRouter,
}))(({ accounts }: { accounts: Account[] }) => ( connect(
state => ({
accounts: accountsSelector(state),
}),
null,
null,
{ pure: false },
),
)(({ accounts }: { accounts: Account[] }) => (
<Fragment> <Fragment>
{accounts.map(account => { {accounts.map(account => {
const Icon = getCryptoCurrencyIcon(account.currency) const Icon = getCryptoCurrencyIcon(account.currency)
@ -155,6 +164,7 @@ const AccountsList = connect(state => ({
)) ))
export default compose( export default compose(
withRouter,
connect(mapStateToProps, mapDispatchToProps, null, { pure: false }), connect(mapStateToProps, mapDispatchToProps, null, { pure: false }),
translate(), translate(),
)(SideBar) )(SideBar)

Loading…
Cancel
Save