Hide duplicates when refreshing token

This commit is contained in:
Gabriel Augendre 2016-04-21 02:24:22 +02:00
parent 09e9c3ff98
commit 80f4369e7b

View file

@ -88,14 +88,21 @@ var DuplicateFinderBox = React.createClass({
currentId: null, currentId: null,
currentUId: null, currentUId: null,
dups: null, dups: null,
dupsLoading: false dupsLoading: false,
clicked: false
}; };
}, },
componentWillReceiveProps: function (nextProps) {
this.setState({
clicked: false
});
},
handlePlaylistClick: function (id, uid) { handlePlaylistClick: function (id, uid) {
this.setState({ this.setState({
currentId: id, currentId: id,
currentUId: uid, currentUId: uid,
dupsLoading: true dupsLoading: true,
clicked: true
}); });
var self = this; var self = this;
@ -117,9 +124,18 @@ var DuplicateFinderBox = React.createClass({
}); });
}, },
render: function () { render: function () {
var duplicates = <p>Loading...</p>; var duplicates;
if (!this.state.dupsLoading) { if (this.state.clicked) {
duplicates = <DuplicatesBox dups={this.state.dups}/>; duplicates = <p>Loading...</p>;
if (!this.state.dupsLoading) {
duplicates = <DuplicatesBox dups={this.state.dups}/>;
}
duplicates = (
<div className="col-md-6">
<h2>Duplicates</h2>
{duplicates}
</div>
)
} }
var playlistBox = <p>Loading...</p>; var playlistBox = <p>Loading...</p>;
if (!this.props.playlistsLoading) { if (!this.props.playlistsLoading) {
@ -131,10 +147,7 @@ var DuplicateFinderBox = React.createClass({
<h2>Playlists</h2> <h2>Playlists</h2>
{playlistBox} {playlistBox}
</div> </div>
<div className="col-md-6"> {duplicates}
<h2>Duplicates</h2>
{duplicates}
</div>
</div> </div>
); );
} }