mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 01:35:11 +00:00
Fix resolving uris in file tile
This commit is contained in:
parent
c023a41a28
commit
72137f51d2
3 changed files with 20 additions and 6 deletions
|
@ -19,11 +19,15 @@ class FileTile extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { isResolvingUri, resolveUri, claim, uri } = this.props;
|
this.resolve(this.props);
|
||||||
|
}
|
||||||
|
|
||||||
if (!isResolvingUri && !claim && uri) {
|
componentWillReceiveProps(nextProps) {
|
||||||
resolveUri(uri);
|
this.resolve(nextProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resolve({ isResolvingUri, claim, uri, resolveUri }) {
|
||||||
|
if (!isResolvingUri && claim === undefined && uri) resolveUri(uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleMouseOver() {
|
handleMouseOver() {
|
||||||
|
|
|
@ -13,6 +13,8 @@ reducers[types.RESOLVE_URI_COMPLETED] = function(state, action) {
|
||||||
if (claim) {
|
if (claim) {
|
||||||
byId[claim.claim_id] = claim;
|
byId[claim.claim_id] = claim;
|
||||||
byUri[uri] = claim.claim_id;
|
byUri[uri] = claim.claim_id;
|
||||||
|
} else {
|
||||||
|
byUri[uri] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Object.assign({}, state, {
|
return Object.assign({}, state, {
|
||||||
|
|
|
@ -17,9 +17,17 @@ export const selectClaimsByUri = createSelector(
|
||||||
|
|
||||||
Object.keys(byUri).forEach(uri => {
|
Object.keys(byUri).forEach(uri => {
|
||||||
const claimId = byUri[uri];
|
const claimId = byUri[uri];
|
||||||
const claim = byId[claimId];
|
|
||||||
|
|
||||||
claims[uri] = claim;
|
// NOTE returning a null claim allows us to differentiate between an
|
||||||
|
// undefined (never fetched claim) and one which just doesn't exist. Not
|
||||||
|
// the cleanest solution but couldn't think of anything better right now
|
||||||
|
if (claimId === null) {
|
||||||
|
claims[uri] = null;
|
||||||
|
} else {
|
||||||
|
const claim = byId[claimId];
|
||||||
|
|
||||||
|
claims[uri] = claim;
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return claims;
|
return claims;
|
||||||
|
|
Loading…
Add table
Reference in a new issue