aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEug-VS <eug-vs@keemail.me>2020-01-07 00:46:23 +0300
committerEug-VS <eug-vs@keemail.me>2020-01-07 00:46:23 +0300
commit002a8c257bb0b78d313ccc30c289534941c9e008 (patch)
tree73a04b9bc030bcf2da4c047a93fdf896180544cb /src
parent4b07be9d2ec37f65de7d1a2c8012815d7baa599c (diff)
downloadchrono-cube-ui-002a8c257bb0b78d313ccc30c289534941c9e008.tar.gz
Avoid timer going crazy bug
Diffstat (limited to 'src')
-rw-r--r--src/components/Timer/Timer.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/components/Timer/Timer.js b/src/components/Timer/Timer.js
index 6fee1b1..99356a5 100644
--- a/src/components/Timer/Timer.js
+++ b/src/components/Timer/Timer.js
@@ -22,6 +22,7 @@ const Timer = ({ registerResult }) => {
const [repeater, setRepeater] = useState(0);
useEffect(()=> {
+ clearInterval(repeater);
const timestamp = Date.now();
if (mode === 'countdown') setRepeater(setInterval(() => {
@@ -36,7 +37,6 @@ const Timer = ({ registerResult }) => {
if (mode === 'over') {
setTime('00:00:00');
- clearInterval(repeater);
}
}, [mode]);