Merge branch 'master' into development

This commit is contained in:
Alex Liebowitz 2017-02-20 01:14:57 -05:00
commit f93ff2c1d7
3 changed files with 15 additions and 9 deletions

View file

@ -249,13 +249,18 @@ export let FileActions = React.createClass({
this._isMounted = true;
this._fileInfoSubscribeId = lbry.fileInfoSubscribe(this.props.sdHash, this.onFileInfoUpdate);
lbry.getStreamAvailability(this.props.streamName, (availability) => {
if (!this._isMounted) {
return;
}
if (this._isMounted) {
this.setState({
available: availability > 0,
});
}
}, () => {
// Take any error to mean the file is unavailable
if (this._isMounted) {
this.setState({
available: false,
});
}
});
},
componentWillUnmount: function() {

View file

@ -177,7 +177,8 @@ export let FileTile = React.createClass({
this._isMounted = true;
lbry.resolveName(this.props.name, (metadata) => {
if (this._isMounted) {
if (this._isMounted && metadata) {
// In case of a failed lookup, metadata will be null, in which case the component will never display
this.setState({
sdHash: metadata.sources.lbry_sd_hash,
metadata: metadata,

View file

@ -207,8 +207,8 @@ lbry.getPeersForBlobHash = function(blobHash, callback) {
});
}
lbry.getStreamAvailability = function(name, callback) {
lbry.call('get_availability', {name: name}, callback);
lbry.getStreamAvailability = function(name, callback, errorCallback) {
lbry.call('get_availability', {name: name}, callback, errorCallback);
}
lbry.getCostInfoForName = function(name, callback, errorCallback) {