Fix first view of shares

This commit is contained in:
Jonathan Cremin 2015-01-27 21:23:05 +00:00
parent 2e0b6a151e
commit 7c1b8aa771

View file

@ -113,12 +113,14 @@ module.exports = React.createClass({
clearInterval(this.state.interval);
}
this.setState({
name: shares[0].name,
artist: shares[0].artist.name,
shares: shares,
shareUrl: "https://match.audio/" + this.props.shares[0].service + "/" + this.props.shares[0].type + "/" + this.props.shares[0].id
});
if (shares.length) {
this.setState({
name: shares[0].name,
artist: shares[0].artist.name,
shares: shares,
shareUrl: "https://match.audio/" + shares[0].service + "/" + shares[0].type + "/" + shares[0].id
});
}
}.bind(this));
}.bind(this)