We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c933ef9 commit c4b8370Copy full SHA for c4b8370
src/useTimer.js
@@ -59,9 +59,14 @@ export default function useTimer(settings) {
59
function handleExtraMilliSeconds(secondsValue, extraMilliSeconds) {
60
setIsRunning(true);
61
intervalRef.current = setTimeout(() => {
62
- intervalRef.current = undefined;
63
- setSeconds(Time.getSecondsFromExpiry(expiryTimestamp));
64
- start();
+ const currentSeconds = Time.getSecondsFromExpiry(expiryTimestamp);
+ setSeconds(currentSeconds);
+ if (currentSeconds <= 0) {
65
+ handleExpire();
66
+ } else {
67
+ intervalRef.current = undefined;
68
+ start();
69
+ }
70
}, extraMilliSeconds);
71
}
72
0 commit comments