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

Loading…
Cancel
Save