diff --git a/web/client/actions/search.js b/web/client/actions/search.js index 84432bf76b..a21889c3f6 100644 --- a/web/client/actions/search.js +++ b/web/client/actions/search.js @@ -15,10 +15,11 @@ const TEXT_SEARCH_RESET = 'TEXT_SEARCH_RESET'; const TEXT_SEARCH_ADD_MARKER = 'TEXT_SEARCH_ADD_MARKER'; const TEXT_SEARCH_TEXT_CHANGE = 'TEXT_SEARCH_TEXT_CHANGE'; -function searchResultLoaded(results) { +function searchResultLoaded(results, append=false) { return { type: TEXT_SEARCH_RESULTS_LOADED, - results: results.data + results: results.data, + append: append }; } diff --git a/web/client/reducers/search.js b/web/client/reducers/search.js index 01912a7a81..682b713c98 100644 --- a/web/client/reducers/search.js +++ b/web/client/reducers/search.js @@ -15,7 +15,11 @@ function search(state = null, action) { case TEXT_SEARCH_TEXT_CHANGE: return assign({}, state, { searchText: action.searchText }); case TEXT_SEARCH_RESULTS_LOADED: - return assign({}, state, { results: action.results }); + let results = action.results; + if (action.append === true && state && state.results) { + results = [...state.results, ...action.results]; + } + return assign({}, state, { results: results }); case TEXT_SEARCH_RESULTS_PURGE: return assign({}, state, { results: null }); case TEXT_SEARCH_ADD_MARKER: