Skip to content

Commit 6f1a4bb

Browse files
committed
Fix tab switching sending unnecessary request
1 parent 0238ffb commit 6f1a4bb

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

front/taskwizard-front/src/components/StartableTask.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,11 @@ const StartableTask = ({ task }: { task: TaskInterface }) => {
7070
useEffect(() => {
7171
const handleVisibilityChange = async () => {
7272
if (!document.hidden) {
73-
console.log(startedRef.current);
74-
await stopTask(task.id);
75-
if (task.timeLeftToday <= 1) {
76-
handleStartedStateChange(_setStarted, false);
77-
} else if (startedRef.current) {
73+
if (startedRef.current) {
74+
await stopTask(task.id);
7875
await startTask(task.id);
76+
} else if (task.timeLeftToday <= 1) {
77+
handleStartedStateChange(_setStarted, false);
7978
}
8079
}
8180
};

0 commit comments

Comments
 (0)