fix bad lighthouse results
This commit is contained in:
parent
4c97cb4ba4
commit
6a16d8e0cd
2 changed files with 6 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { lighthouse } from 'redux/actions/search';
|
import { lighthouse } from 'redux/actions/search';
|
||||||
import { getSearchQueryString } from 'util/query-params';
|
import { getSearchQueryString } from 'util/query-params';
|
||||||
|
import { isURIValid } from 'lbry-redux';
|
||||||
import useThrottle from './use-throttle';
|
import useThrottle from './use-throttle';
|
||||||
|
|
||||||
export default function useLighthouse(query: string, showMature?: boolean, size?: number = 5) {
|
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)
|
.search(throttledQuery)
|
||||||
.then(results => {
|
.then(results => {
|
||||||
if (isSubscribed) {
|
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);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import * as ACTIONS from 'constants/action_types';
|
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 { makeSelectSearchUris, makeSelectQueryWithOptions, selectSearchValue } from 'redux/selectors/search';
|
||||||
import handleFetchResponse from 'util/handle-fetch';
|
import handleFetchResponse from 'util/handle-fetch';
|
||||||
|
|
||||||
|
@ -71,7 +71,9 @@ export const doSearch = (rawQuery: string, searchOptions: SearchOptions) => (
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = buildURI(urlObj);
|
const url = buildURI(urlObj);
|
||||||
uris.push(url);
|
if (isURIValid(url)) {
|
||||||
|
uris.push(url);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue