ClaimListDiscover: perform secondary has_no_search search as well.

This commit is contained in:
infinite-persistence 2021-04-29 16:17:06 +08:00 committed by Sean Yesmunt
parent c2a766a3e8
commit ec5e14ca96
2 changed files with 8 additions and 1 deletions

View file

@ -43,6 +43,7 @@ type Props = {
claimsByUri: { [string]: any }, claimsByUri: { [string]: any },
liveLivestreamsFirst?: boolean, liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any }, livestreamMap?: { [string]: any },
searchOptions?: any,
}; };
export default function ClaimList(props: Props) { export default function ClaimList(props: Props) {
@ -72,6 +73,7 @@ export default function ClaimList(props: Props) {
claimsByUri, claimsByUri,
liveLivestreamsFirst, liveLivestreamsFirst,
livestreamMap, livestreamMap,
searchOptions,
} = props; } = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW); const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
@ -80,7 +82,7 @@ export default function ClaimList(props: Props) {
const liveUris = []; const liveUris = [];
if (liveLivestreamsFirst && livestreamMap) { if (liveLivestreamsFirst && livestreamMap) {
prioritizeActiveLivestreams(uris, liveUris, livestreamMap, claimsByUri, claimSearchByQuery); prioritizeActiveLivestreams(uris, liveUris, livestreamMap, claimsByUri, claimSearchByQuery, searchOptions);
} }
const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || []; const sortedUris = (urisLength > 0 && (currentSort === SORT_NEW ? uris : uris.slice().reverse())) || [];

View file

@ -448,6 +448,9 @@ function ClaimListDiscover(props: Props) {
if (shouldPerformSearch) { if (shouldPerformSearch) {
const searchOptions = JSON.parse(optionsStringForEffect); const searchOptions = JSON.parse(optionsStringForEffect);
doClaimSearch(searchOptions); doClaimSearch(searchOptions);
if (liveLivestreamsFirst && options.page === 1) {
doClaimSearch({ ...searchOptions, has_no_source: true });
}
} }
}, [doClaimSearch, shouldPerformSearch, optionsStringForEffect, forceRefresh]); }, [doClaimSearch, shouldPerformSearch, optionsStringForEffect, forceRefresh]);
@ -500,6 +503,7 @@ function ClaimListDiscover(props: Props) {
showHiddenByUser={showHiddenByUser} showHiddenByUser={showHiddenByUser}
liveLivestreamsFirst={liveLivestreamsFirst} liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap} livestreamMap={livestreamMap}
searchOptions={options}
/> />
{loading && ( {loading && (
<div className="claim-grid"> <div className="claim-grid">
@ -532,6 +536,7 @@ function ClaimListDiscover(props: Props) {
showHiddenByUser={showHiddenByUser} showHiddenByUser={showHiddenByUser}
liveLivestreamsFirst={liveLivestreamsFirst} liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap} livestreamMap={livestreamMap}
searchOptions={options}
/> />
{loading && {loading &&
new Array(dynamicPageSize) new Array(dynamicPageSize)