diff --git a/flow-typed/search.js b/flow-typed/search.js index 7327ab997..adfb768f6 100644 --- a/flow-typed/search.js +++ b/flow-typed/search.js @@ -37,6 +37,7 @@ declare type SearchSuccess = { type: ACTIONS.SEARCH_SUCCESS, data: { query: string, + from: number, size: number, uris: Array, }, diff --git a/ui/redux/actions/search.js b/ui/redux/actions/search.js index 0d0eee63f..036c5c614 100644 --- a/ui/redux/actions/search.js +++ b/ui/redux/actions/search.js @@ -5,7 +5,8 @@ import { makeSelectSearchUris, makeSelectQueryWithOptions, selectSearchValue, - selectSearchOptions} from 'redux/selectors/search'; + selectSearchOptions, +} from 'redux/selectors/search'; import handleFetchResponse from 'util/handle-fetch'; type Dispatch = (action: any) => any; @@ -93,6 +94,7 @@ export const doSearch = (rawQuery: string, searchOptions: SearchOptions) => ( type: ACTIONS.SEARCH_SUCCESS, data: { query: queryWithOptions, + from: from, size: size, uris, }, diff --git a/ui/redux/reducers/search.js b/ui/redux/reducers/search.js index 089cf9f7a..3253c95b2 100644 --- a/ui/redux/reducers/search.js +++ b/ui/redux/reducers/search.js @@ -27,11 +27,11 @@ export default handleActions( searching: true, }), [ACTIONS.SEARCH_SUCCESS]: (state: SearchState, action: SearchSuccess): SearchState => { - const { query, uris, size } = action.data; + const { query, uris, from, size } = action.data; const normalizedQuery = createNormalizedSearchKey(query); let newUris = uris; - if (state.urisByQuery[normalizedQuery]) { + if (from !== 0 && state.urisByQuery[normalizedQuery]) { newUris = Array.from(new Set(state.urisByQuery[normalizedQuery].concat(uris))); }