Only concatenate results if 'from !== 0'
This commit is contained in:
parent
340c883ac7
commit
8111b8d9dc
3 changed files with 6 additions and 3 deletions
1
flow-typed/search.js
vendored
1
flow-typed/search.js
vendored
|
@ -37,6 +37,7 @@ declare type SearchSuccess = {
|
|||
type: ACTIONS.SEARCH_SUCCESS,
|
||||
data: {
|
||||
query: string,
|
||||
from: number,
|
||||
size: number,
|
||||
uris: Array<string>,
|
||||
},
|
||||
|
|
|
@ -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,
|
||||
},
|
||||
|
|
|
@ -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)));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue