Merge remote-tracking branch 'parent/main' into kb_migration
This commit is contained in:
commit
979292d950
56 changed files with 774 additions and 277 deletions
|
@ -14,8 +14,7 @@ import {
|
|||
SEARCH_SHOW,
|
||||
SEARCH_EXPAND_REQUEST,
|
||||
SEARCH_EXPAND_SUCCESS,
|
||||
SEARCH_RESULT_CLICK,
|
||||
SEARCH_RESULT_FORGET,
|
||||
SEARCH_HISTORY_UPDATE,
|
||||
} from '../actions/search';
|
||||
|
||||
const initialState = ImmutableMap({
|
||||
|
@ -80,10 +79,8 @@ export default function search(state = initialState, action) {
|
|||
case SEARCH_EXPAND_SUCCESS:
|
||||
const results = action.searchType === 'hashtags' ? ImmutableOrderedSet(fromJS(action.results.hashtags)) : action.results[action.searchType].map(item => item.id);
|
||||
return state.updateIn(['results', action.searchType], list => list.union(results)).setIn(['noMoreResults', action.searchType], results.size <= 0);
|
||||
case SEARCH_RESULT_CLICK:
|
||||
return state.update('recent', set => set.add(fromJS(action.result)));
|
||||
case SEARCH_RESULT_FORGET:
|
||||
return state.update('recent', set => set.filterNot(result => result.get('q') === action.q));
|
||||
case SEARCH_HISTORY_UPDATE:
|
||||
return state.set('recent', ImmutableOrderedSet(fromJS(action.recent)));
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue