From d4f2ebe96bc61b903d29b72fc6a5f07126dd4a2e Mon Sep 17 00:00:00 2001 From: meriadec Date: Sun, 3 Jun 2018 13:15:31 +0200 Subject: [PATCH] This react-router thing is becoming ridiculous --- src/components/SideBar/index.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/components/SideBar/index.js b/src/components/SideBar/index.js index cbc64845..227df258 100644 --- a/src/components/SideBar/index.js +++ b/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 { } } -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[] }) => ( {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)