From ef9d4f4e0615bcc42528e2e73ade0ba02baa3ed9 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sat, 8 Oct 2016 00:01:22 +0200 Subject: Use reselect to memoize denormalization in UI state Also upgrade react-redux to latest version. This is a performance update --- .../javascripts/components/features/account/index.jsx | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'app/assets/javascripts/components/features/account') diff --git a/app/assets/javascripts/components/features/account/index.jsx b/app/assets/javascripts/components/features/account/index.jsx index 9c77214d1..21aa8c5d6 100644 --- a/app/assets/javascripts/components/features/account/index.jsx +++ b/app/assets/javascripts/components/features/account/index.jsx @@ -20,22 +20,18 @@ import { } from '../../actions/interactions'; import Header from './components/header'; import { - selectStatus, - selectAccount -} from '../../reducers/timelines'; + getAccountTimeline, + getAccount +} from '../../selectors'; import StatusList from '../../components/status_list'; import LoadingIndicator from '../../components/loading_indicator'; import Immutable from 'immutable'; import ActionBar from './components/action_bar'; import Column from '../ui/components/column'; -function selectStatuses(state, accountId) { - return state.getIn(['timelines', 'accounts_timelines', accountId], Immutable.List([])).map(id => selectStatus(state, id)).filterNot(status => status === null); -}; - const mapStateToProps = (state, props) => ({ - account: selectAccount(state, Number(props.params.accountId)), - statuses: selectStatuses(state, Number(props.params.accountId)), + account: getAccount(state, Number(props.params.accountId)), + statuses: getAccountTimeline(state, Number(props.params.accountId)), me: state.getIn(['timelines', 'me']) }); -- cgit