Closed d9k closed 2 years ago
This was actually by design, but after the recent changes to reset
I think your suggestion should be implemented. I will get this out in the next release.
@d9k, This is resolved in 5.4.1
. I added a test for this case so you should be good to go, but feel free to re open if you are still having issues.
I tried to update my code. With 5.4.2
after reset()
time doesn't go "below zero", but actually there is a delay before getTotalActiveTime()
gets > 0 again. So strange...
1) Can't debug compiled react-idle-timer with storybook in my project because when I try to pretty print oneliner in Chrome dev tools it's empty 2) Tried to include react-idle-timer to the code of my project to debug how it works with my code but got so many compilation errors...
ERROR in /home/user/my-project/lib/react-idle-timer/IdleTimerContext.tsx(7,59):
TS2345: Argument of type 'null' is not assignable to parameter of type 'IIdleTimer'.
ERROR in /home/user/my-project/lib/react-idle-timer/IdleTimerContext.tsx(24,8):
TS2532: Object is possibly 'undefined'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(29,5):
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(29,22):
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(30,5):
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(43,9):
TS2531: Object is possibly 'null'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(61,5):
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(75,19):
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(76,5):
TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
No index signature with a parameter of type 'string' was found on type '{}'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(80,5):
TS2322: Type '((this: MessagePort, ev: MessageEvent<any>) => any) | null' is not assignable to type '(event: MessageEvent<any>) => void'.
Type 'null' is not assignable to type '(event: MessageEvent<any>) => void'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(88,5):
TS2322: Type '((this: MessagePort, ev: MessageEvent<any>) => any) | null' is not assignable to type '(event: MessageEvent<any>) => void'.
Type 'null' is not assignable to type '(event: MessageEvent<any>) => void'.
ERROR in /home/user/my-project/lib/react-idle-timer/TabManager/BroadcastChannel.ts(96,12):
@SupremeTechnopriest, how can I rebuild react-idle-timer 5.4.2 (index.esm.js) locally without minification to debug it step-by-step with my code?
Bug information
Affected Module
Version
:5.4.0
Describe the bug
timer.reset()
doesn't affecttimer.getTotalActiveTime()
result.To Reproduce
Expected behavior
T2
should be0
. But it'sT1
.System Information (please complete the following information)
OS
: Ubuntu 18.04Device
: DesktopBrowser Vendor
: ChromeBrowser Version
: 102.0.5005.61Additional context
See previous issue about
getTotalActiveTime()
andreset
: https://github.com/SupremeTechnopriest/react-idle-timer/issues/257