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,
|
type: ACTIONS.SEARCH_SUCCESS,
|
||||||
data: {
|
data: {
|
||||||
query: string,
|
query: string,
|
||||||
|
from: number,
|
||||||
size: number,
|
size: number,
|
||||||
uris: Array<string>,
|
uris: Array<string>,
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,7 +5,8 @@ import {
|
||||||
makeSelectSearchUris,
|
makeSelectSearchUris,
|
||||||
makeSelectQueryWithOptions,
|
makeSelectQueryWithOptions,
|
||||||
selectSearchValue,
|
selectSearchValue,
|
||||||
selectSearchOptions} from 'redux/selectors/search';
|
selectSearchOptions,
|
||||||
|
} from 'redux/selectors/search';
|
||||||
import handleFetchResponse from 'util/handle-fetch';
|
import handleFetchResponse from 'util/handle-fetch';
|
||||||
|
|
||||||
type Dispatch = (action: any) => any;
|
type Dispatch = (action: any) => any;
|
||||||
|
@ -93,6 +94,7 @@ export const doSearch = (rawQuery: string, searchOptions: SearchOptions) => (
|
||||||
type: ACTIONS.SEARCH_SUCCESS,
|
type: ACTIONS.SEARCH_SUCCESS,
|
||||||
data: {
|
data: {
|
||||||
query: queryWithOptions,
|
query: queryWithOptions,
|
||||||
|
from: from,
|
||||||
size: size,
|
size: size,
|
||||||
uris,
|
uris,
|
||||||
},
|
},
|
||||||
|
|
|
@ -27,11 +27,11 @@ export default handleActions(
|
||||||
searching: true,
|
searching: true,
|
||||||
}),
|
}),
|
||||||
[ACTIONS.SEARCH_SUCCESS]: (state: SearchState, action: SearchSuccess): SearchState => {
|
[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);
|
const normalizedQuery = createNormalizedSearchKey(query);
|
||||||
|
|
||||||
let newUris = uris;
|
let newUris = uris;
|
||||||
if (state.urisByQuery[normalizedQuery]) {
|
if (from !== 0 && state.urisByQuery[normalizedQuery]) {
|
||||||
newUris = Array.from(new Set(state.urisByQuery[normalizedQuery].concat(uris)));
|
newUris = Array.from(new Set(state.urisByQuery[normalizedQuery].concat(uris)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue