Updated featured group_lists to be randomized on init

• Updated:
- featured group_lists to be randomized on init
This commit is contained in:
mgabdev 2020-07-14 00:22:15 -05:00
parent 56d0698536
commit f3e34d40d2

View File

@ -40,7 +40,10 @@ export default function groupLists(state = initialState, action) {
});
case GROUPS_FETCH_SUCCESS:
return state.withMutations((mutable) => {
mutable.setIn([action.tab, 'items'], ImmutableList(action.groups.map(item => item.id)))
let list = ImmutableList(action.groups.map(item => item.id))
if (action.tab === 'featured') list = list.sortBy(Math.random)
mutable.setIn([action.tab, 'items'], list)
mutable.setIn([action.tab, 'isLoading'], false)
mutable.setIn([action.tab, 'isFetched'], true)
})