about summary refs log tree commit diff
path: root/app/assets/javascripts/components/selectors
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-24 17:11:02 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-24 18:08:23 +0200
commitf8f40f15dafca65dc07d5c5c19fb9a9dc3473dd6 (patch)
treeb9817a27143158a5c26f9b447a8a58dbb4b272d3 /app/assets/javascripts/components/selectors
parent61db14bcbe424731c01cf782e8e147a9551c6125 (diff)
Move status components inside individual containers. We still need to select
all statuses/accounts to assemble, but at least lists don't have to be
re-rendered all the time now. Also add "mention" dropdown option
Diffstat (limited to 'app/assets/javascripts/components/selectors')
-rw-r--r--app/assets/javascripts/components/selectors/index.jsx36
1 files changed, 8 insertions, 28 deletions
diff --git a/app/assets/javascripts/components/selectors/index.jsx b/app/assets/javascripts/components/selectors/index.jsx
index 91f900f90..b571e43d5 100644
--- a/app/assets/javascripts/components/selectors/index.jsx
+++ b/app/assets/javascripts/components/selectors/index.jsx
@@ -17,15 +17,15 @@ export const getAccount = createSelector([getAccountBase, getAccountRelationship
 
 const getStatusBase = (state, id) => state.getIn(['timelines', 'statuses', id], null);
 
-export const getStatus = createSelector([getStatusBase, getStatuses, getAccounts], (base, statuses, accounts) => {
-  if (base === null) {
-    return null;
-  }
-
-  return assembleStatus(base.get('id'), statuses, accounts);
-});
+export const makeGetStatus = () => {
+  return createSelector([getStatusBase, getStatuses, getAccounts], (base, statuses, accounts) => {
+    if (base === null) {
+      return null;
+    }
 
-const getAccountTimelineIds = (state, id) => state.getIn(['timelines', 'accounts_timelines', id], Immutable.List());
+    return assembleStatus(base.get('id'), statuses, accounts);
+  });
+};
 
 const assembleStatus = (id, statuses, accounts) => {
   let status = statuses.get(id, null);
@@ -48,26 +48,6 @@ const assembleStatus = (id, statuses, accounts) => {
   return status.set('reblog', reblog).set('account', accounts.get(status.get('account')));
 };
 
-const assembleStatusList = (ids, statuses, accounts) => {
-  return ids.map(statusId => assembleStatus(statusId, statuses, accounts)).filterNot(status => status === null);
-};
-
-export const getAccountTimeline = createSelector([getAccountTimelineIds, getStatuses, getAccounts], assembleStatusList);
-
-const getTimelineIds = (state, timelineType) => state.getIn(['timelines', timelineType]);
-
-export const makeGetTimeline = () => {
-  return createSelector([getTimelineIds, getStatuses, getAccounts], assembleStatusList);
-};
-
-const getStatusAncestorsIds = (state, id) => state.getIn(['timelines', 'ancestors', id], Immutable.OrderedSet());
-
-export const getStatusAncestors = createSelector([getStatusAncestorsIds, getStatuses, getAccounts], assembleStatusList);
-
-const getStatusDescendantsIds = (state, id) => state.getIn(['timelines', 'descendants', id], Immutable.OrderedSet());
-
-export const getStatusDescendants = createSelector([getStatusDescendantsIds, getStatuses, getAccounts], assembleStatusList);
-
 const getNotificationsBase = state => state.get('notifications');
 
 export const getNotifications = createSelector([getNotificationsBase], (base) => {