Fix hidden purchases through embeds

## Issue
1345

## Change
The refactor in  04c5ac46 broke the logic, because `!hasCost` would incorrectly include an undefined `costInfo` (haven't fetched) as free content.
This commit is contained in:
infinite-persistence 2022-04-18 13:47:21 +08:00
parent 3f805a6189
commit cfc34c5dba
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -142,10 +142,10 @@ export default function EmbedWrapperPage(props: Props) {
doResolveUri(uri);
}
if (uri && haveClaim && !hasCost) {
if (uri && haveClaim && costInfo && costInfo.cost === 0) {
doPlayUri(uri);
}
}, [doPlayUri, doResolveUri, hasCost, haveClaim, uri]);
}, [doPlayUri, doResolveUri, haveClaim, costInfo, uri]);
React.useEffect(() => {
if (haveClaim && uri && doFetchCostInfoForUri) {