Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Add dependency array
Browse files Browse the repository at this point in the history
  • Loading branch information
khelif96 committed Dec 13, 2023
1 parent 4b4bce0 commit 65fcd94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/pages/task/metadata/ETATimer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ const ETATimer: React.FC<ETATimerProps> = ({ expectedDuration, startTime }) => {
Date.now()
);
setEta(newEta > 0 ? newEta : 0);
if (newEta <= 0) {
clearInterval(timer);
}
}, 1000);
if (eta === 0) {
clearInterval(timer);
}

return () => clearInterval(timer);
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
<MetadataItem data-cy="task-metadata-eta">
Expand Down
3 changes: 2 additions & 1 deletion src/pages/task/metadata/RuntimeTimer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const RuntimeTimer: React.FC<RuntimeTimerProps> = ({ startTime }) => {
}, 1000);

return () => clearInterval(timer);
});
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

return (
<MetadataItem data-cy="task-metadata-running-time">
Expand Down

0 comments on commit 65fcd94

Please sign in to comment.