]> cat aescling's git repositories - mastodon.git/commitdiff
use makeMapStateToProps
authorcwm <chriswmartin@protonmail.com>
Mon, 18 Dec 2017 04:00:25 +0000 (22:00 -0600)
committercwm <chriswmartin@protonmail.com>
Mon, 18 Dec 2017 04:00:25 +0000 (22:00 -0600)
app/javascript/flavours/glitch/features/getting_started/index.js

index 9782d4d3256e7def32eb916c952cd89fba8417ad..ed9d9d1a0f3e58c0e49c4e0b19e4faa5f93e0dc0 100644 (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 = {