diff --git a/ui/js/actions/app.js b/ui/js/actions/app.js
index 1c0a9e338..c2ec3dcab 100644
--- a/ui/js/actions/app.js
+++ b/ui/js/actions/app.js
@@ -28,6 +28,7 @@ export function doNavigate(path, params = {}) {
if (params)
url = `${url}?${queryStringFromParams(params)}`
+ console.log('Path: ' + url);
dispatch(doChangePath(url))
const state = getState()
diff --git a/ui/js/actions/content.js b/ui/js/actions/content.js
index ca820f157..fe8dbe0b6 100644
--- a/ui/js/actions/content.js
+++ b/ui/js/actions/content.js
@@ -44,7 +44,7 @@ export function doResolveUri(uri) {
const {
claim,
certificate,
- } = resolutionInfo
+ } = resolutionInfo ? resolutionInfo : { claim : null, certificate: null }
dispatch({
type: types.RESOLVE_URI_COMPLETED,
diff --git a/ui/js/actions/cost_info.js b/ui/js/actions/cost_info.js
index 278f1d7b4..ceab6433b 100644
--- a/ui/js/actions/cost_info.js
+++ b/ui/js/actions/cost_info.js
@@ -21,7 +21,7 @@ export function doFetchCostInfoForUri(uri) {
costInfo,
}
})
- })
+ }).catch(() => {})
}
}
diff --git a/ui/js/component/fileCard/view.jsx b/ui/js/component/fileCard/view.jsx
index 9b5513298..99c95c93b 100644
--- a/ui/js/component/fileCard/view.jsx
+++ b/ui/js/component/fileCard/view.jsx
@@ -63,7 +63,7 @@ class FileCard extends React.Component {
- {metadata &&
+ {metadata && metadata.thumbnail &&
diff --git a/ui/js/component/uriIndicator/view.jsx b/ui/js/component/uriIndicator/view.jsx
index cc3d4f0eb..36486578f 100644
--- a/ui/js/component/uriIndicator/view.jsx
+++ b/ui/js/component/uriIndicator/view.jsx
@@ -6,14 +6,20 @@ import {Icon} from 'component/common';
const UriIndicator = (props) => {
const {
uri,
- claim: {
- has_signature: hasSignature,
- signature_is_valid: signatureIsValid,
- } = {},
+ claim
} = props
const uriObj = lbryuri.parse(uri);
+ if (!claim) {
+ return
Unused
+ }
+
+ const {
+ has_signature: hasSignature,
+ signature_is_valid: signatureIsValid
+ } = claim
+
if (!hasSignature || !uriObj.isChannel) {
return
Anonymous;
}
diff --git a/ui/js/lbry.js b/ui/js/lbry.js
index 2adcd49dd..5dacc389d 100644
--- a/ui/js/lbry.js
+++ b/ui/js/lbry.js
@@ -254,6 +254,9 @@ lbry.getCostInfo = function(uri) {
function getCostGenerous(uri) {
// If generous is on, the calculation is simple enough that we might as well do it here in the front end
lbry.resolve({uri: uri}).then((resolutionInfo) => {
+ if (!resolutionInfo) {
+ return reject(new Error("Unused URI"));
+ }
const fee = resolutionInfo.claim.value.stream.metadata.fee;
if (fee === undefined) {
cacheAndResolve(0, true);
diff --git a/ui/js/page/showPage/index.js b/ui/js/page/showPage/index.js
index 8155da8dd..86dbe394d 100644
--- a/ui/js/page/showPage/index.js
+++ b/ui/js/page/showPage/index.js
@@ -2,6 +2,12 @@ import React from 'react'
import {
connect
} from 'react-redux'
+import {
+ doResolveUri,
+} from 'actions/content'
+import {
+ doNavigate,
+} from 'actions/app'
import {
selectCurrentUri,
} from 'selectors/app'
@@ -17,19 +23,27 @@ import {
import {
selectCurrentUriCostInfo,
} from 'selectors/cost_info'
+import {
+ makeSelectResolvingUri,
+} from 'selectors/content'
import ShowPage from './view'
-const select = (state) => ({
- claim: selectCurrentUriClaim(state),
- uri: selectCurrentUri(state),
- isDownloaded: selectCurrentUriIsDownloaded(state),
- fileInfo: selectCurrentUriFileInfo(state),
- costInfo: selectCurrentUriCostInfo(state),
- isFailed: false,
- claimType: 'file',
-})
+const makeSelect = () => {
+ const selectResolvingUri = makeSelectResolvingUri()
+
+ const select = (state, props) => ({
+ claim: selectCurrentUriClaim(state),
+ uri: selectCurrentUri(state),
+ isResolvingUri: selectResolvingUri(state, props),
+ claimType: 'file',
+ })
+
+ return select
+}
const perform = (dispatch) => ({
+ navigate: (path, params) => dispatch(doNavigate(path, params)),
+ resolveUri: (uri) => dispatch(doResolveUri(uri)),
})
-export default connect(select, perform)(ShowPage)
+export default connect(makeSelect, perform)(ShowPage)
diff --git a/ui/js/page/showPage/view.jsx b/ui/js/page/showPage/view.jsx
index 24418b5bf..4205c3e73 100644
--- a/ui/js/page/showPage/view.jsx
+++ b/ui/js/page/showPage/view.jsx
@@ -4,69 +4,63 @@ import {
} from 'component/common';
import FilePage from 'page/filePage'
-const ShowPage = (props) => {
- const {
- claim,
- navigate,
- claim: {
- txid,
- nout,
- has_signature: hasSignature,
- signature_is_valid: signatureIsValid,
- value,
- value: {
- stream,
- stream: {
- metadata,
- source,
- metadata: {
- title,
- } = {},
- source: {
- contentType,
+class ShowPage extends React.Component{
+ componentWillMount() {
+ const {
+ isResolvingUri,
+ resolveUri,
+ claim,
+ uri,
+ } = this.props
+
+ if(!isResolvingUri && !claim && uri) {
+ resolveUri(uri)
+ }
+ }
+
+ render() {
+ const {
+ claim: {
+ value: {
+ stream: {
+ metadata
} = {},
} = {},
} = {},
- },
- uri,
- isDownloaded,
- fileInfo,
- costInfo,
- costInfo: {
- cost,
- includesData: costIncludesData,
- } = {},
- isFailed,
- claimType,
- } = props
+ navigate,
+ uri,
+ isResolvingUri,
+ claimType,
+ } = this.props
- const outpoint = txid + ':' + nout;
- const uriLookupComplete = !!claim && Object.keys(claim).length
- const pageTitle = metadata ? metadata.title : uri;
+ const pageTitle = metadata ? metadata.title : uri;
let innerContent = "";
- if (!uriLookupComplete || isFailed) {
+ if (isResolvingUri) {
innerContent =
-
-
- { uriLookupComplete ?
-
This location is not yet in use. { ' ' } navigate('/publish')} label="Put something here" />.
:
-
- }
-
+
+
+ { isResolvingUri ?
+
:
+
This location is not yet in use. { ' ' } navigate('/publish')} label="Put something here" />.
+ }
+
;
- } else if (claimType == "channel") {
+ }
+ else if (claimType == "channel") {
innerContent =
- } else {
+ }
+ else {
innerContent =
}
return (
{innerContent}
)
+ }
}
export default ShowPage
diff --git a/ui/js/selectors/claims.js b/ui/js/selectors/claims.js
index 45007b94e..a755eea18 100644
--- a/ui/js/selectors/claims.js
+++ b/ui/js/selectors/claims.js
@@ -16,12 +16,14 @@ export const selectClaimsByUri = createSelector(
export const selectCurrentUriClaim = createSelector(
selectCurrentUri,
selectClaimsByUri,
- (uri, byUri) => byUri[uri] || {}
+ (uri, byUri) => byUri[uri]
)
export const selectCurrentUriClaimOutpoint = createSelector(
selectCurrentUriClaim,
- (claim) => `${claim.txid}:${claim.nout}`
+ (claim) => {
+ return claim ? `${claim.txid}:${claim.nout}` : null
+ }
)
const selectClaimForUri = (state, props) => {
diff --git a/ui/js/selectors/file_info.js b/ui/js/selectors/file_info.js
index 7c9439495..cbe5b665c 100644
--- a/ui/js/selectors/file_info.js
+++ b/ui/js/selectors/file_info.js
@@ -71,10 +71,17 @@ export const shouldFetchCurrentUriFileInfo = createSelector(
selectFetchingCurrentUriFileInfo,
selectCurrentUriFileInfo,
(page, uri, fetching, fileInfo) => {
+ console.log('should fetch?');
+ console.log(page);
+ console.log(uri);
+ console.log(fetching);
+
if (page != 'show') return false
if (fetching) return false
if (fileInfo != undefined) return false
+ console.log('fetch!');
+
return true
}
)