Merge pull request #65 from lbryio/background-search
add isBackgroundSearch param to doSearch function
This commit is contained in:
commit
8794a775bf
1 changed files with 4 additions and 2 deletions
|
@ -13,7 +13,8 @@ const DEFAULTSEARCHRESULTFROM = 0;
|
||||||
export const doSearch = (
|
export const doSearch = (
|
||||||
rawQuery,
|
rawQuery,
|
||||||
size = DEFAULTSEARCHRESULTSIZE,
|
size = DEFAULTSEARCHRESULTSIZE,
|
||||||
from = DEFAULTSEARCHRESULTFROM
|
from = DEFAULTSEARCHRESULTFROM,
|
||||||
|
isBackgroundSearch
|
||||||
) => (dispatch, getState) => {
|
) => (dispatch, getState) => {
|
||||||
const state = getState();
|
const state = getState();
|
||||||
const query = rawQuery.replace(/^lbry:\/\//i, '');
|
const query = rawQuery.replace(/^lbry:\/\//i, '');
|
||||||
|
@ -38,7 +39,8 @@ export const doSearch = (
|
||||||
// If the user is on the file page with a pre-populated uri and they select
|
// If the user is on the file page with a pre-populated uri and they select
|
||||||
// the search option without typing anything, searchQuery will be empty
|
// the search option without typing anything, searchQuery will be empty
|
||||||
// We need to populate it so the input is filled on the search page
|
// We need to populate it so the input is filled on the search page
|
||||||
if (!state.search.searchQuery) {
|
// isBackgroundSearch means the search is happening in the background, don't update the search query
|
||||||
|
if (!state.search.searchQuery && !isBackgroundSearch) {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: ACTIONS.UPDATE_SEARCH_QUERY,
|
type: ACTIONS.UPDATE_SEARCH_QUERY,
|
||||||
data: { searchQuery: query },
|
data: { searchQuery: query },
|
||||||
|
|
Loading…
Reference in a new issue