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 },
liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any },
searchOptions?: any,
};
export default function ClaimList(props: Props) {
@ -72,6 +73,7 @@ export default function ClaimList(props: Props) {
claimsByUri,
liveLivestreamsFirst,
livestreamMap,
searchOptions,
} = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
@ -80,7 +82,7 @@ export default function ClaimList(props: Props) {
const liveUris = [];
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())) || [];

View file

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