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/status/index.jsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/assets/javascripts/components/features/status/index.jsx') diff --git a/app/assets/javascripts/components/features/status/index.jsx b/app/assets/javascripts/components/features/status/index.jsx index b282956b1..1d40f127b 100644 --- a/app/assets/javascripts/components/features/status/index.jsx +++ b/app/assets/javascripts/components/features/status/index.jsx @@ -10,16 +10,16 @@ import ActionBar from './components/action_bar'; import Column from '../ui/components/column'; import { favourite, reblog } from '../../actions/interactions'; import { replyCompose } from '../../actions/compose'; -import { selectStatus } from '../../reducers/timelines'; - -function selectStatuses(state, ids) { - return ids.map(id => selectStatus(state, id)).filterNot(status => status === null); -}; +import { + getStatus, + getStatusAncestors, + getStatusDescendants +} from '../../selectors'; const mapStateToProps = (state, props) => ({ - status: selectStatus(state, Number(props.params.statusId)), - ancestors: selectStatuses(state, state.getIn(['timelines', 'ancestors', Number(props.params.statusId)], Immutable.OrderedSet())), - descendants: selectStatuses(state, state.getIn(['timelines', 'descendants', Number(props.params.statusId)], Immutable.OrderedSet())), + status: getStatus(state, Number(props.params.statusId)), + ancestors: getStatusAncestors(state, Number(props.params.statusId)), + descendants: getStatusDescendants(state, Number(props.params.statusId)), me: state.getIn(['timelines', 'me']) }); -- cgit