use makeMapStateToProps

master
cwm 7 years ago
parent e4ebbf4f07
commit be50e45a74
  1. 16
      app/javascript/flavours/glitch/features/getting_started/index.js

@ -32,22 +32,26 @@ const messages = defineMessages({
misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' }, misc: { id: 'navigation_bar.misc', defaultMessage: 'Misc' },
}); });
const getOrderedLists = createSelector([state => state.get('lists')], lists => { const makeMapStateToProps = () => {
const getOrderedLists = createSelector([state => state.get('lists')], lists => {
if (!lists) { if (!lists) {
return 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 => ({ const mapStateToProps = state => ({
lists: getOrderedLists(state),
myAccount: state.getIn(['accounts', me]), myAccount: state.getIn(['accounts', me]),
columns: state.getIn(['settings', 'columns']), columns: state.getIn(['settings', 'columns']),
lists: getOrderedLists(state), });
});
return mapStateToProps;
}
@connect(mapStateToProps)
@injectIntl @injectIntl
@connect(makeMapStateToProps)
export default class GettingStarted extends ImmutablePureComponent { export default class GettingStarted extends ImmutablePureComponent {
static propTypes = { static propTypes = {

Loading…
Cancel
Save