fix bad lighthouse results

This commit is contained in:
zeppi 2021-01-28 14:03:37 -05:00 committed by Sean Yesmunt
parent 4c97cb4ba4
commit 6a16d8e0cd
2 changed files with 6 additions and 3 deletions

View file

@ -2,6 +2,7 @@
import React from 'react';
import { lighthouse } from 'redux/actions/search';
import { getSearchQueryString } from 'util/query-params';
import { isURIValid } from 'lbry-redux';
import useThrottle from './use-throttle';
export default function useLighthouse(query: string, showMature?: boolean, size?: number = 5) {
@ -20,7 +21,7 @@ export default function useLighthouse(query: string, showMature?: boolean, size?
.search(throttledQuery)
.then(results => {
if (isSubscribed) {
setResults(results.map(result => `lbry://${result.name}#${result.claimId}`));
setResults(results.map(result => `lbry://${result.name}#${result.claimId}`).filter(uri => isURIValid(uri)));
setLoading(false);
}
})

View file

@ -1,6 +1,6 @@
// @flow
import * as ACTIONS from 'constants/action_types';
import { buildURI, doResolveUris, batchActions } from 'lbry-redux';
import { buildURI, doResolveUris, batchActions, isURIValid } from 'lbry-redux';
import { makeSelectSearchUris, makeSelectQueryWithOptions, selectSearchValue } from 'redux/selectors/search';
import handleFetchResponse from 'util/handle-fetch';
@ -71,7 +71,9 @@ export const doSearch = (rawQuery: string, searchOptions: SearchOptions) => (
}
const url = buildURI(urlObj);
uris.push(url);
if (isURIValid(url)) {
uris.push(url);
}
}
});