Skip to content

Commit f756318

Browse files
committed
remove ref thats not needed
1 parent 1e72be2 commit f756318

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/lib/hooks/useAssessmentTimer.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use client';
22

3-
import { useEffect, useRef, useState } from 'react';
3+
import { useEffect, useState } from 'react';
44

55
function formatTime(seconds: number): string {
66
const mins = Math.floor(seconds / 60);
@@ -10,7 +10,6 @@ function formatTime(seconds: number): string {
1010

1111
export function useAssessmentTimer(totalTimeSeconds: number, started: boolean) {
1212
const [remainingSeconds, setRemainingSeconds] = useState(totalTimeSeconds);
13-
const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
1413

1514
// totalTimeSeconds is 0 on first render (sections not loaded); sync when tasks arrive.
1615
useEffect(() => {
@@ -29,11 +28,8 @@ export function useAssessmentTimer(totalTimeSeconds: number, started: boolean) {
2928
return prev - 1;
3029
});
3130
}, 1000);
32-
intervalRef.current = id;
3331

34-
return () => {
35-
if (intervalRef.current) clearInterval(intervalRef.current);
36-
};
32+
return () => clearInterval(id);
3733
}, [started]);
3834

3935
return {

0 commit comments

Comments
 (0)