don't call get for hidden claims
This commit is contained in:
parent
6d46686e7e
commit
eab7807d59
2 changed files with 13 additions and 4 deletions
|
@ -93,7 +93,6 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
|||
const claimsInChannel = (claim && claim.meta.claims_in_channel) || 0;
|
||||
const showPublishLink = abandoned && placeholder === 'publish';
|
||||
const hideActions = type === 'small' || type === 'tooltip';
|
||||
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile) || thumbnail;
|
||||
|
||||
let name;
|
||||
let isValid = false;
|
||||
|
@ -149,6 +148,10 @@ const ClaimPreview = forwardRef<any, {}>((props: Props, ref: any) => {
|
|||
}
|
||||
}
|
||||
|
||||
// Weird placement warning
|
||||
// Make sure this happens after we figure out if this claim needs to be hidden
|
||||
const thumbnailUrl = useGetThumbnail(uri, claim, streamingUrl, getFile, shouldHide) || thumbnail;
|
||||
|
||||
function handleContextMenu(e) {
|
||||
// @if TARGET='app'
|
||||
e.preventDefault();
|
||||
|
|
|
@ -2,7 +2,13 @@
|
|||
import React from 'react';
|
||||
import { generateStreamUrl } from 'util/lbrytv';
|
||||
|
||||
export default function useGetThumbnail(uri: string, claim: ?Claim, streamingUrl: ?string, getFile: string => void) {
|
||||
export default function useGetThumbnail(
|
||||
uri: string,
|
||||
claim: ?Claim,
|
||||
streamingUrl: ?string,
|
||||
getFile: string => void,
|
||||
shouldHide: boolean
|
||||
) {
|
||||
const hasClaim = claim !== undefined;
|
||||
|
||||
// $FlowFixMe
|
||||
|
@ -27,11 +33,11 @@ export default function useGetThumbnail(uri: string, claim: ?Claim, streamingUrl
|
|||
if (hasClaim && isImage && isFree) {
|
||||
if (streamingUrl) {
|
||||
setThumbnail(streamingUrl);
|
||||
} else {
|
||||
} else if (!shouldHide) {
|
||||
getFile(uri);
|
||||
}
|
||||
}
|
||||
}, [hasClaim, isFree, isImage, streamingUrl, uri]);
|
||||
}, [hasClaim, isFree, isImage, streamingUrl, uri, shouldHide]);
|
||||
// @endif
|
||||
|
||||
return thumbnail;
|
||||
|
|
Loading…
Reference in a new issue