Minor cleanup, no functional change
- Self-documenting variable. - Remove incorrect comments. - Remove redundant variables.
This commit is contained in:
parent
8c20d516cd
commit
dd5f4872fc
2 changed files with 5 additions and 16 deletions
|
@ -642,11 +642,7 @@ function ClaimListDiscover(props: Props) {
|
||||||
|
|
||||||
useFetchViewCount(fetchViewCount, finalUris, claimsByUri, doFetchViewCount);
|
useFetchViewCount(fetchViewCount, finalUris, claimsByUri, doFetchViewCount);
|
||||||
|
|
||||||
const shouldFetchUserMemberships = true;
|
useGetUserMemberships(true, finalUris, claimsByUri, doFetchUserMemberships);
|
||||||
const arrayOfContentUris = finalUris;
|
|
||||||
const convertClaimUrlsToIds = claimsByUri;
|
|
||||||
|
|
||||||
useGetUserMemberships(shouldFetchUserMemberships, arrayOfContentUris, convertClaimUrlsToIds, doFetchUserMemberships);
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
if (shouldPerformSearch) {
|
if (shouldPerformSearch) {
|
||||||
|
|
|
@ -81,10 +81,8 @@ function ClaimTilesDiscover(props: Props) {
|
||||||
doFetchUserMemberships,
|
doFetchUserMemberships,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
// reference to the claim-grid
|
const listRef = React.useRef();
|
||||||
const sectionRef = React.useRef();
|
const injectedIndex = useLastVisibleItem(injectedItem, listRef);
|
||||||
// determine the index where the ad should be injected
|
|
||||||
const injectedIndex = useLastVisibleItem(injectedItem, sectionRef);
|
|
||||||
|
|
||||||
const prevUris = React.useRef();
|
const prevUris = React.useRef();
|
||||||
const claimSearchUris = claimSearchResults || [];
|
const claimSearchUris = claimSearchResults || [];
|
||||||
|
@ -119,12 +117,9 @@ function ClaimTilesDiscover(props: Props) {
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
// --------------------------------------------------------------------------
|
// --------------------------------------------------------------------------
|
||||||
|
|
||||||
// populate the view counts for the current claim uris
|
|
||||||
useFetchViewCount(fetchViewCount, uris, claimsByUri, doFetchViewCount);
|
useFetchViewCount(fetchViewCount, uris, claimsByUri, doFetchViewCount);
|
||||||
|
|
||||||
const shouldFetchUserMemberships = true;
|
useGetUserMemberships(true, uris, claimsByUri, doFetchUserMemberships);
|
||||||
|
|
||||||
useGetUserMemberships(shouldFetchUserMemberships, uris, claimsByUri, doFetchUserMemberships);
|
|
||||||
|
|
||||||
// Run `doClaimSearch`
|
// Run `doClaimSearch`
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
|
@ -135,11 +130,10 @@ function ClaimTilesDiscover(props: Props) {
|
||||||
}, [doClaimSearch, shouldPerformSearch, optionsStringified]);
|
}, [doClaimSearch, shouldPerformSearch, optionsStringified]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ul ref={sectionRef} className="claim-grid">
|
<ul ref={listRef} className="claim-grid">
|
||||||
{finalUris && finalUris.length
|
{finalUris && finalUris.length
|
||||||
? finalUris.map((uri, i) => {
|
? finalUris.map((uri, i) => {
|
||||||
if (uri) {
|
if (uri) {
|
||||||
// if indexes match, inject ad in place of tile (aka replace it)
|
|
||||||
if (injectedIndex === i && injectedItem && injectedItem.replace) {
|
if (injectedIndex === i && injectedItem && injectedItem.replace) {
|
||||||
return <React.Fragment key={uri}>{injectedItem.node}</React.Fragment>;
|
return <React.Fragment key={uri}>{injectedItem.node}</React.Fragment>;
|
||||||
}
|
}
|
||||||
|
@ -147,7 +141,6 @@ function ClaimTilesDiscover(props: Props) {
|
||||||
return (
|
return (
|
||||||
<React.Fragment key={uri}>
|
<React.Fragment key={uri}>
|
||||||
{injectedIndex === i && injectedItem && injectedItem.node}
|
{injectedIndex === i && injectedItem && injectedItem.node}
|
||||||
{/* inject ad */}
|
|
||||||
<ClaimPreviewTile
|
<ClaimPreviewTile
|
||||||
showNoSourceClaims={hasNoSource || showNoSourceClaims}
|
showNoSourceClaims={hasNoSource || showNoSourceClaims}
|
||||||
uri={uri}
|
uri={uri}
|
||||||
|
|
Loading…
Add table
Reference in a new issue