Skip to content

Commit cfc1672

Browse files
Randy LebeauRandy Lebeau
authored andcommitted
🐞 Regression fix for onAction.
1 parent df5b2b8 commit cfc1672

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/useIdleTimer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,15 @@ function useIdleTimer ({
316316
// Create debounced action if applicable
317317
if (debounce > 0) {
318318
emitOnAction.current = debounced(onAction, debounce)
319-
}
320319

321320
// Create throttled action if applicable
322-
if (throttle > 0) {
321+
} else if (throttle > 0) {
323322
emitOnAction.current = throttled(onAction, throttle)
324-
}
325323

326324
// No throttle or debounce
327-
emitOnAction.current = onAction
325+
} else {
326+
emitOnAction.current = onAction
327+
}
328328
}, [onAction])
329329

330330
return {

0 commit comments

Comments
 (0)