fix resolve loop
This commit is contained in:
parent
ffa248a353
commit
d8098d8eb1
2 changed files with 17 additions and 4 deletions
|
@ -8,6 +8,7 @@ import {
|
|||
makeSelectTitleForUri,
|
||||
normalizeURI,
|
||||
makeSelectClaimIsMine,
|
||||
makeSelectClaimIsPending,
|
||||
} from 'lbry-redux';
|
||||
import { makeSelectChannelInSubscriptions } from 'redux/selectors/subscriptions';
|
||||
import { selectBlackListedOutpoints } from 'lbryinc';
|
||||
|
@ -42,6 +43,7 @@ const select = (state, props) => {
|
|||
uri,
|
||||
title: makeSelectTitleForUri(uri)(state),
|
||||
claimIsMine: makeSelectClaimIsMine(uri)(state),
|
||||
claimIsPending: makeSelectClaimIsPending(uri)(state),
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -22,11 +22,22 @@ type Props = {
|
|||
nout: number,
|
||||
}>,
|
||||
title: string,
|
||||
claimIsMine: Boolean,
|
||||
claimIsMine: boolean,
|
||||
claimIsPending: boolean,
|
||||
};
|
||||
|
||||
function ShowPage(props: Props) {
|
||||
const { isResolvingUri, resolveUri, uri, claim, blackListedOutpoints, location, claimIsMine, isSubscribed } = props;
|
||||
const {
|
||||
isResolvingUri,
|
||||
resolveUri,
|
||||
uri,
|
||||
claim,
|
||||
blackListedOutpoints,
|
||||
location,
|
||||
claimIsMine,
|
||||
isSubscribed,
|
||||
claimIsPending,
|
||||
} = props;
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
const canonicalUrl = claim && claim.canonical_url;
|
||||
const claimExists = claim !== null && claim !== undefined;
|
||||
|
@ -45,11 +56,11 @@ function ShowPage(props: Props) {
|
|||
|
||||
if (
|
||||
(resolveUri && !isResolvingUri && uri && haventFetchedYet) ||
|
||||
(claimExists && (!canonicalUrl || isMine === undefined))
|
||||
(claimExists && !claimIsPending && (!canonicalUrl || isMine === undefined))
|
||||
) {
|
||||
resolveUri(uri);
|
||||
}
|
||||
}, [resolveUri, isResolvingUri, canonicalUrl, uri, claimExists, haventFetchedYet, history, isMine]);
|
||||
}, [resolveUri, isResolvingUri, canonicalUrl, uri, claimExists, haventFetchedYet, history, isMine, claimIsPending]);
|
||||
|
||||
// Don't navigate directly to repost urls
|
||||
// Always redirect to the actual content
|
||||
|
|
Loading…
Reference in a new issue