about summary refs log tree commit diff
path: root/app/assets/javascripts/components/features/status
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-08 00:01:22 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-08 00:01:22 +0200
commitef9d4f4e0615bcc42528e2e73ade0ba02baa3ed9 (patch)
treef3e90eab6ebae1ba4b1061362e91f98dda2dc5bc /app/assets/javascripts/components/features/status
parent1f650d327d35bc48b897da99914c43750d8e5fd3 (diff)
Use reselect to memoize denormalization in UI state
Also upgrade react-redux to latest version. This is a performance update
Diffstat (limited to 'app/assets/javascripts/components/features/status')
-rw-r--r--app/assets/javascripts/components/features/status/index.jsx16
1 files changed, 8 insertions, 8 deletions
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'])
 });