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,
|
makeSelectTitleForUri,
|
||||||
normalizeURI,
|
normalizeURI,
|
||||||
makeSelectClaimIsMine,
|
makeSelectClaimIsMine,
|
||||||
|
makeSelectClaimIsPending,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { makeSelectChannelInSubscriptions } from 'redux/selectors/subscriptions';
|
import { makeSelectChannelInSubscriptions } from 'redux/selectors/subscriptions';
|
||||||
import { selectBlackListedOutpoints } from 'lbryinc';
|
import { selectBlackListedOutpoints } from 'lbryinc';
|
||||||
|
@ -42,6 +43,7 @@ const select = (state, props) => {
|
||||||
uri,
|
uri,
|
||||||
title: makeSelectTitleForUri(uri)(state),
|
title: makeSelectTitleForUri(uri)(state),
|
||||||
claimIsMine: makeSelectClaimIsMine(uri)(state),
|
claimIsMine: makeSelectClaimIsMine(uri)(state),
|
||||||
|
claimIsPending: makeSelectClaimIsPending(uri)(state),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,22 @@ type Props = {
|
||||||
nout: number,
|
nout: number,
|
||||||
}>,
|
}>,
|
||||||
title: string,
|
title: string,
|
||||||
claimIsMine: Boolean,
|
claimIsMine: boolean,
|
||||||
|
claimIsPending: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
function ShowPage(props: Props) {
|
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 signingChannel = claim && claim.signing_channel;
|
||||||
const canonicalUrl = claim && claim.canonical_url;
|
const canonicalUrl = claim && claim.canonical_url;
|
||||||
const claimExists = claim !== null && claim !== undefined;
|
const claimExists = claim !== null && claim !== undefined;
|
||||||
|
@ -45,11 +56,11 @@ function ShowPage(props: Props) {
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(resolveUri && !isResolvingUri && uri && haventFetchedYet) ||
|
(resolveUri && !isResolvingUri && uri && haventFetchedYet) ||
|
||||||
(claimExists && (!canonicalUrl || isMine === undefined))
|
(claimExists && !claimIsPending && (!canonicalUrl || isMine === undefined))
|
||||||
) {
|
) {
|
||||||
resolveUri(uri);
|
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
|
// Don't navigate directly to repost urls
|
||||||
// Always redirect to the actual content
|
// Always redirect to the actual content
|
||||||
|
|
Loading…
Reference in a new issue