diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-10-08 00:01:22 +0200 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-10-08 00:01:22 +0200 |
commit | ef9d4f4e0615bcc42528e2e73ade0ba02baa3ed9 (patch) | |
tree | f3e90eab6ebae1ba4b1061362e91f98dda2dc5bc /app/assets/javascripts/components/features/ui/containers/status_list_container.jsx | |
parent | 1f650d327d35bc48b897da99914c43750d8e5fd3 (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/ui/containers/status_list_container.jsx')
-rw-r--r-- | app/assets/javascripts/components/features/ui/containers/status_list_container.jsx | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/app/assets/javascripts/components/features/ui/containers/status_list_container.jsx b/app/assets/javascripts/components/features/ui/containers/status_list_container.jsx index 605216eba..045cc59d1 100644 --- a/app/assets/javascripts/components/features/ui/containers/status_list_container.jsx +++ b/app/assets/javascripts/components/features/ui/containers/status_list_container.jsx @@ -8,14 +8,18 @@ import { unfavourite } from '../../../actions/interactions'; import { expandTimeline } from '../../../actions/timelines'; -import { selectStatus } from '../../../reducers/timelines'; +import { makeGetTimeline } from '../../../selectors'; import { deleteStatus } from '../../../actions/statuses'; -const mapStateToProps = function (state, props) { - return { - statuses: state.getIn(['timelines', props.type]).map(id => selectStatus(state, id)), +const makeMapStateToProps = () => { + const getTimeline = makeGetTimeline(); + + const mapStateToProps = (state, props) => ({ + statuses: getTimeline(state, props.type), me: state.getIn(['timelines', 'me']) - }; + }); + + return mapStateToProps; }; const mapDispatchToProps = function (dispatch, props) { @@ -50,4 +54,4 @@ const mapDispatchToProps = function (dispatch, props) { }; }; -export default connect(mapStateToProps, mapDispatchToProps)(StatusList); +export default connect(makeMapStateToProps, mapDispatchToProps)(StatusList); |