always batch resolve search results

This commit is contained in:
Sean Yesmunt 2020-08-12 13:02:19 -04:00
parent 2db2b870ff
commit abbaa8bf78

View file

@ -1,6 +1,6 @@
// @flow // @flow
import * as ACTIONS from 'constants/action_types'; import * as ACTIONS from 'constants/action_types';
import { buildURI, doResolveUri, batchActions } from 'lbry-redux'; import { buildURI, doResolveUris, batchActions } from 'lbry-redux';
import { import {
makeSelectSearchUris, makeSelectSearchUris,
selectSuggestions, selectSuggestions,
@ -20,7 +20,6 @@ type SearchOptions = {
related_to?: string, related_to?: string,
nsfw?: boolean, nsfw?: boolean,
isBackgroundSearch?: boolean, isBackgroundSearch?: boolean,
resolveResults?: boolean,
}; };
// We can't use env's because they aren't passed into node_modules // We can't use env's because they aren't passed into node_modules
@ -84,7 +83,6 @@ export const doSearch = (rawQuery: string, searchOptions: SearchOptions) => (
getState: GetState getState: GetState
) => { ) => {
const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' '); const query = rawQuery.replace(/^lbry:\/\//i, '').replace(/\//, ' ');
const resolveResults = searchOptions && searchOptions.resolveResults;
const isBackgroundSearch = (searchOptions && searchOptions.isBackgroundSearch) || false; const isBackgroundSearch = (searchOptions && searchOptions.isBackgroundSearch) || false;
if (!query) { if (!query) {
@ -136,13 +134,12 @@ export const doSearch = (rawQuery: string, searchOptions: SearchOptions) => (
} }
const url = buildURI(urlObj); const url = buildURI(urlObj);
if (resolveResults) {
actions.push(doResolveUri(url));
}
uris.push(url); uris.push(url);
} }
}); });
actions.push(doResolveUris(uris));
actions.push({ actions.push({
type: ACTIONS.SEARCH_SUCCESS, type: ACTIONS.SEARCH_SUCCESS,
data: { data: {