From 19652e29dcfa93af4c8c23775a5f764a476a22e1 Mon Sep 17 00:00:00 2001 From: Larbi Gharib <larbi.gharib@savoirfairelinux.com> Date: Tue, 20 Oct 2020 13:51:33 -0400 Subject: [PATCH] Create user regression Change-Id: I89b169e3ebf4a831a3e2f2be096aa5ce0d96d356 --- .../UserProfile/EditCreateUserProfile.js | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js b/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js index 2c754162..4fcd0bec 100644 --- a/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js +++ b/jams-react-client/src/views/UserProfile/EditCreateUserProfile.js @@ -274,17 +274,18 @@ export default function EditCreateUserProfile(props) { }; React.useEffect(() => { - setLoading(true); - const timer = setInterval(() => { - setProgress((oldProgress) => { - if (oldProgress === 100) { - return 0; - } - const diff = Math.random() * 10; - return Math.min(oldProgress + diff, 100); - }); - }, 500); + if (!createUser) { + setLoading(true); + const timer = setInterval(() => { + setProgress((oldProgress) => { + if (oldProgress === 100) { + return 0; + } + const diff = Math.random() * 10; + return Math.min(oldProgress + diff, 100); + }); + }, 500); setUserName(props.username); axios( configApiCall( @@ -320,10 +321,11 @@ export default function EditCreateUserProfile(props) { .catch((error) => { console.log("Error fetching user : " + props.username + " " + error); }); + + return () => { + clearInterval(timer); + }; } - return () => { - clearInterval(timer); - }; }, []); const resizeFile = (file, outputFormat) => -- GitLab