From 15998abf892e99c9df56d69a7aad9307c45fa4f7 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sat, 4 Jul 2020 19:37:07 -0500 Subject: [PATCH] Refactor account reducer --- app/soapbox/reducers/accounts.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/soapbox/reducers/accounts.js b/app/soapbox/reducers/accounts.js index 894cd0a15..fd915d7ff 100644 --- a/app/soapbox/reducers/accounts.js +++ b/app/soapbox/reducers/accounts.js @@ -8,13 +8,13 @@ import { Map as ImmutableMap, fromJS } from 'immutable'; const initialState = ImmutableMap(); const normalizeAccount = (state, account) => { - account = { ...account }; + const normalized = fromJS(account).deleteAll([ + 'followers_count', + 'following_count', + 'statuses_count', + ]); - delete account.followers_count; - delete account.following_count; - delete account.statuses_count; - - return state.set(account.id, fromJS(account)); + return state.set(account.id, normalized); }; const normalizeAccounts = (state, accounts) => {