mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-31 17:31:27 +00:00
fix infinite loops on unclaimed URLs (somewhat ugly)
This commit is contained in:
parent
142b1eb529
commit
a6b83a0b08
2 changed files with 15 additions and 8 deletions
|
@ -45,11 +45,16 @@ export function doResolveUris(uris) {
|
||||||
let resolveInfo = {};
|
let resolveInfo = {};
|
||||||
lbry.resolve({ uris: urisToResolve }).then(result => {
|
lbry.resolve({ uris: urisToResolve }).then(result => {
|
||||||
for (let [uri, uriResolveInfo] of Object.entries(result)) {
|
for (let [uri, uriResolveInfo] of Object.entries(result)) {
|
||||||
const { claim, certificate, claims_in_channel } = uriResolveInfo || {
|
const fallbackResolveInfo = {
|
||||||
claim: undefined,
|
claim: null,
|
||||||
claims_in_channel: undefined,
|
claims_in_channel: null,
|
||||||
certificate: undefined,
|
certificate: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const { claim, certificate, claims_in_channel } = uriResolveInfo &&
|
||||||
|
!uriResolveInfo.error
|
||||||
|
? uriResolveInfo
|
||||||
|
: fallbackResolveInfo;
|
||||||
resolveInfo[uri] = { claim, certificate, claims_in_channel };
|
resolveInfo[uri] = { claim, certificate, claims_in_channel };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,16 +6,18 @@ import FilePage from "page/file";
|
||||||
|
|
||||||
class ShowPage extends React.PureComponent {
|
class ShowPage extends React.PureComponent {
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
const { resolveUri, uri } = this.props;
|
const { isResolvingUri, resolveUri, uri } = this.props;
|
||||||
|
|
||||||
resolveUri(uri);
|
if (!isResolvingUri) resolveUri(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
const { resolveUri, uri } = nextProps;
|
const { isResolvingUri, resolveUri, claim, uri } = nextProps;
|
||||||
|
|
||||||
|
if (!isResolvingUri && claim === undefined && uri) {
|
||||||
resolveUri(uri);
|
resolveUri(uri);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { claim, isResolvingUri, uri } = this.props;
|
const { claim, isResolvingUri, uri } = this.props;
|
||||||
|
|
Loading…
Add table
Reference in a new issue