Skip to content

Commit

Permalink
reverted changes related to clearInterval
Browse files Browse the repository at this point in the history
  • Loading branch information
aleckslu committed Mar 31, 2024
1 parent 81d02c9 commit cae9e25
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/app/_components/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
CSSProperties,
useCallback,
useEffect,
useMemo,
useRef,
Expand All @@ -9,7 +8,7 @@ import {

type DashBoardProps = {
startHr: number;
startMin: number;
startMin: number;
startSec: number;
};

Expand Down Expand Up @@ -40,7 +39,7 @@ export default function Dashboard({
if (seconds === 0) {
if (minutes === 0) {
if (hours === 0) {
setActiveTimer(false);
clearInterval(timerRef.current);
} else {
setHours(hours - 1);
setMinutes(59);
Expand All @@ -54,8 +53,6 @@ export default function Dashboard({
setSeconds(seconds - 1);
}
}, 1000);
} else {
clearInterval(timerRef.current);
}
return () => clearInterval(timerRef.current);
}, [activeTimer, hours, minutes, seconds]);
Expand All @@ -75,6 +72,7 @@ export default function Dashboard({
const pause = () => {
// Clears the interval to stop the timer from updating
setActiveTimer(false);
clearInterval(timerRef.current);
};

return (
Expand Down

0 comments on commit cae9e25

Please sign in to comment.