From 9c67882cf15e653b76dd9e18e179a03a5bdfd54e Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Thu, 4 Jun 2020 18:52:26 -0400 Subject: [PATCH] Updated group_lists reducer booleans MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - group_lists reducer booleans to be isLoading, isFetched --- app/javascript/gabsocial/actions/groups.js | 4 +-- .../gabsocial/reducers/group_lists.js | 26 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/javascript/gabsocial/actions/groups.js b/app/javascript/gabsocial/actions/groups.js index 8d27e8e7..e7068681 100644 --- a/app/javascript/gabsocial/actions/groups.js +++ b/app/javascript/gabsocial/actions/groups.js @@ -136,8 +136,8 @@ export const fetchGroups = (tab) => (dispatch, getState) => { if (!me) return // Don't refetch or fetch when loading - const isLoading = getState().getIn(['group_lists', tab, 'loading']) - const isFetched = getState().getIn(['group_lists', tab, 'fetched']) + const isLoading = getState().getIn(['group_lists', tab, 'isLoading']) + const isFetched = getState().getIn(['group_lists', tab, 'isFetched']) if (isLoading || isFetched) return diff --git a/app/javascript/gabsocial/reducers/group_lists.js b/app/javascript/gabsocial/reducers/group_lists.js index a65e8c32..9ea14367 100644 --- a/app/javascript/gabsocial/reducers/group_lists.js +++ b/app/javascript/gabsocial/reducers/group_lists.js @@ -9,23 +9,23 @@ const tabs = ['new', 'featured', 'member', 'admin'] const initialState = ImmutableMap({ new: ImmutableMap({ - fetched: false, - loading: false, + isFetched: false, + isLoading: false, items: ImmutableList(), }), featured: ImmutableMap({ - fetched: false, - loading: false, + isFetched: false, + isLoading: false, items: ImmutableList(), }), member: ImmutableMap({ - fetched: false, - loading: false, + isFetched: false, + isLoading: false, items: ImmutableList(), }), admin: ImmutableMap({ - fetched: false, - loading: false, + isFetched: false, + isLoading: false, items: ImmutableList(), }), }) @@ -36,19 +36,19 @@ export default function groupLists(state = initialState, action) { switch(action.type) { case GROUPS_FETCH_REQUEST: return state.withMutations((mutable) => { - mutable.setIn([action.tab, 'loading'], true) + mutable.setIn([action.tab, 'isLoading'], true) }); case GROUPS_FETCH_SUCCESS: return state.withMutations((mutable) => { mutable.setIn([action.tab, 'items'], ImmutableList(action.groups.map(item => item.id))) - mutable.setIn([action.tab, 'loading'], false) - mutable.setIn([action.tab, 'fetched'], true) + mutable.setIn([action.tab, 'isLoading'], false) + mutable.setIn([action.tab, 'isFetched'], true) }) case GROUPS_FETCH_FAIL: return state.withMutations((mutable) => { mutable.setIn([action.tab, 'items'], ImmutableList()) - mutable.setIn([action.tab, 'loading'], false) - mutable.setIn([action.tab, 'fetched'], true) + mutable.setIn([action.tab, 'isLoading'], false) + mutable.setIn([action.tab, 'isFetched'], true) }) default: return state