diff --git a/app/soapbox/components/sidebar_menu.js b/app/soapbox/components/sidebar_menu.js index caabe7f0c..b13410342 100644 --- a/app/soapbox/components/sidebar_menu.js +++ b/app/soapbox/components/sidebar_menu.js @@ -53,17 +53,13 @@ const makeMapStateToProps = () => { const me = state.get('me'); const soapbox = getSoapboxConfig(state); - const accounts = state.get('accounts'); - const authUsers = state.getIn(['auth', 'users']); - const otherAccounts = getOtherAccounts(accounts, authUsers, me); - return { account: getAccount(state, me), sidebarOpen: state.get('sidebar').sidebarOpen, donateUrl: state.getIn(['patron', 'instance', 'url']), hasCrypto: typeof soapbox.getIn(['cryptoAddresses', 0, 'ticker']) === 'string', isStaff: isStaff(state.getIn(['accounts', me])), - otherAccounts, + otherAccounts: getOtherAccounts(state), }; }; diff --git a/app/soapbox/features/ui/components/profile_dropdown.js b/app/soapbox/features/ui/components/profile_dropdown.js index c58201a64..b5162d931 100644 --- a/app/soapbox/features/ui/components/profile_dropdown.js +++ b/app/soapbox/features/ui/components/profile_dropdown.js @@ -24,13 +24,9 @@ const makeMapStateToProps = () => { const mapStateToProps = state => { const me = state.get('me'); - const accounts = state.get('accounts'); - const authUsers = state.getIn(['auth', 'users']); - const otherAccounts = getOtherAccounts(accounts, authUsers, me); - return { account: state.getIn(['accounts', me]), - otherAccounts, + otherAccounts: getOtherAccounts(state), isStaff: isStaff(state.getIn(['accounts', me])), }; }; diff --git a/app/soapbox/selectors/index.js b/app/soapbox/selectors/index.js index 81882e646..0615db229 100644 --- a/app/soapbox/selectors/index.js +++ b/app/soapbox/selectors/index.js @@ -197,16 +197,18 @@ export const makeGetReport = () => { }; export const makeGetOtherAccounts = () => { - return createSelector( - [(accounts, authUsers, me) => { - return authUsers - .keySeq() - .reduce((list, id) => { - if (id === me) return list; - const account = accounts.get(id); - return account ? list.push(account) : list; - }, ImmutableList()); - }], - otherAccounts => otherAccounts, - ); + return createSelector([ + state => state.get('accounts'), + state => state.getIn(['auth', 'users']), + state => state.get('me'), + ], + (accounts, authUsers, me) => { + return authUsers + .keySeq() + .reduce((list, id) => { + if (id === me) return list; + const account = accounts.get(id); + return account ? list.push(account) : list; + }, ImmutableList()); + }); };