From 7a6e8ddabc03100943c1c49cf8c0501d6cdc9213 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Fri, 30 Aug 2019 12:28:36 -0400 Subject: [PATCH] fixes: recommended content + crashes --- dist/bundle.es.js | 8 ++++---- src/lbryURI.js | 2 +- src/redux/selectors/claims.js | 6 ++---- src/redux/selectors/publish.js | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index f04595a..1827e89 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -1045,7 +1045,7 @@ function buildURI(UrlObj, includeProto = true, protoDefault = 'lbry://') { const { claimId, claimName, contentName } = deprecatedParts; if (!claimName && !channelName && !streamName) { - throw new Error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.")); + console.error(__("'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url.")); } const formattedChannelName = channelName && (channelName.startsWith('@') ? channelName : `@${channelName}`); @@ -1724,8 +1724,8 @@ const makeSelectRecommendedContentForUri = uri => reselect.createSelector(makeSe let recommendedContent; if (claim) { - // If we are at a vanity uri, build the full uri so we can properly filter - const currentUri = atVanityURI ? buildURI({ streamClaimId: claim.claim_id, streamName: claim.name }) : uri; + // always grab full URL - this can change once search returns canonical + const currentUri = buildURI({ streamClaimId: claim.claim_id, streamName: claim.name }); const { title } = claim.value; @@ -2874,7 +2874,7 @@ const selectIsResolvingPublishUris = reselect.createSelector(selectState$5, sele const { isChannel } = parseURI(uri); let isResolvingShortUri; - if (isChannel) { + if (isChannel && name) { const shortUri = buildURI({ streamName: name }); isResolvingShortUri = resolvingUris.includes(shortUri); } diff --git a/src/lbryURI.js b/src/lbryURI.js index c22dbbf..aeeff2c 100644 --- a/src/lbryURI.js +++ b/src/lbryURI.js @@ -199,7 +199,7 @@ export function buildURI( } if (!claimName && !channelName && !streamName) { - throw new Error( + console.error( __( "'claimName', 'channelName', and 'streamName' are all empty. One must be present to build a url." ) diff --git a/src/redux/selectors/claims.js b/src/redux/selectors/claims.js index 9fbea4d..6e983b9 100644 --- a/src/redux/selectors/claims.js +++ b/src/redux/selectors/claims.js @@ -456,10 +456,8 @@ export const makeSelectRecommendedContentForUri = (uri: string) => let recommendedContent; if (claim) { - // If we are at a vanity uri, build the full uri so we can properly filter - const currentUri = atVanityURI - ? buildURI({ streamClaimId: claim.claim_id, streamName: claim.name }) - : uri; + // always grab full URL - this can change once search returns canonical + const currentUri = buildURI({ streamClaimId: claim.claim_id, streamName: claim.name }); const { title } = claim.value; diff --git a/src/redux/selectors/publish.js b/src/redux/selectors/publish.js index ac468c9..ce0a20c 100644 --- a/src/redux/selectors/publish.js +++ b/src/redux/selectors/publish.js @@ -84,7 +84,7 @@ export const selectIsResolvingPublishUris = createSelector( const { isChannel } = parseURI(uri); let isResolvingShortUri; - if (isChannel) { + if (isChannel && name) { const shortUri = buildURI({ streamName: name }); isResolvingShortUri = resolvingUris.includes(shortUri); }