use makeMapStateToProps

lolsob-rspec
cwm 2017-12-17 22:00:25 -06:00
parent d6ca0e29a7
commit 1dd4e3791f
1 changed files with 16 additions and 12 deletions

View File

@ -32,22 +32,26 @@ const messages = defineMessages({
misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' },
});
const getOrderedLists = createSelector([state => state.get('lists')], lists => {
if (!lists) {
return lists;
}
const makeMapStateToProps = () => {
const getOrderedLists = createSelector([state => state.get('lists')], lists => {
if (!lists) {
return lists;
}
return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title')));
});
return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title')));
});
const mapStateToProps = state => ({
myAccount: state.getIn(['accounts', me]),
columns: state.getIn(['settings', 'columns']),
lists: getOrderedLists(state),
});
const mapStateToProps = state => ({
lists: getOrderedLists(state),
myAccount: state.getIn(['accounts', me]),
columns: state.getIn(['settings', 'columns']),
});
return mapStateToProps;
}
@connect(mapStateToProps)
@injectIntl
@connect(makeMapStateToProps)
export default class GettingStarted extends ImmutablePureComponent {
static propTypes = {