From 80f4369e7bf70536746db3d97d8ea0385701c0b7 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Thu, 21 Apr 2016 02:24:22 +0200 Subject: [PATCH] Hide duplicates when refreshing token --- public/script.js | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/public/script.js b/public/script.js index 0ec532e..f7c90b4 100644 --- a/public/script.js +++ b/public/script.js @@ -88,14 +88,21 @@ var DuplicateFinderBox = React.createClass({ currentId: null, currentUId: null, dups: null, - dupsLoading: false + dupsLoading: false, + clicked: false }; }, + componentWillReceiveProps: function (nextProps) { + this.setState({ + clicked: false + }); + }, handlePlaylistClick: function (id, uid) { this.setState({ currentId: id, currentUId: uid, - dupsLoading: true + dupsLoading: true, + clicked: true }); var self = this; @@ -117,9 +124,18 @@ var DuplicateFinderBox = React.createClass({ }); }, render: function () { - var duplicates =

Loading...

; - if (!this.state.dupsLoading) { - duplicates = ; + var duplicates; + if (this.state.clicked) { + duplicates =

Loading...

; + if (!this.state.dupsLoading) { + duplicates = ; + } + duplicates = ( +
+

Duplicates

+ {duplicates} +
+ ) } var playlistBox =

Loading...

; if (!this.props.playlistsLoading) { @@ -131,10 +147,7 @@ var DuplicateFinderBox = React.createClass({

Playlists

{playlistBox} -
-

Duplicates

- {duplicates} -
+ {duplicates} ); }