Updated user suggestions in reducer to be randomized

• Updated:
- user suggestions in reducer to be randomized
This commit is contained in:
mgabdev 2020-11-05 16:16:11 -06:00
parent 40627c6c3f
commit c1cc0e6355

View File

@ -27,7 +27,8 @@ export default function suggestionsReducer(state = initialState, action) {
return state.setIn([action.suggestionType, 'isLoading'], true) return state.setIn([action.suggestionType, 'isLoading'], true)
case SUGGESTIONS_FETCH_SUCCESS: case SUGGESTIONS_FETCH_SUCCESS:
return state.withMutations((map) => { return state.withMutations((map) => {
map.setIn([action.suggestionType, 'items'], fromJS(action.accounts.map(x => x.id))) const items = fromJS(action.accounts.map(x => x.id)).sortBy(Math.random)
map.setIn([action.suggestionType, 'items'], items)
map.setIn([action.suggestionType, 'isLoading'], false) map.setIn([action.suggestionType, 'isLoading'], false)
}) })
case SUGGESTIONS_FETCH_FAIL: case SUGGESTIONS_FETCH_FAIL: