Pause timer bug upon starting browser
Opened this issue · 4 comments
This worked properly in the last release so has newly broken in v1.2.0. It might be related to "dark mode" since I have that turned on and now see the IB screen in dark when seeing this error.
I am not 100% sure how to reproduce but it seems that when I sometimes return to Firefox and go to a site that is blocked by IB, I then go to the menu to pause it but it already shows as paused and always for slightly less than 60 minutes. I have to cancel pause (even though it is not really paused) and then start a pause again to see might site. The 60 minutes is noteworthy because I never pause more than 5 or 15 minutes. So, it is some default value that it is getting elsewhere.
This is on Windows x86.
I also have seen this, but I am using Firefox on Mac and I don't use dark mode. So it is not specific to Windows or dark mode.
I can't reproduce it 100% reliably either but it seems to happen if I pause, close FF during the pause period and then re-open it after the pause would have elapsed. As far as I can see it is actually blocking normally, just the UI shows a pause timer. This timer just runs from 60 minutes to zero and rolls around to 60 minutes again.
Is it somethng to do with the way it restores its state in function boot()
?
impulse-blocker/src/ImpulseBlocker.js
Lines 33 to 50 in 5e7a841
The rolling one hour timer is, I believe, just because of this code:
impulse-blocker/src/popup/components/Pause/PauseSection.js
Lines 79 to 91 in 5e7a841
Somehow
this.state.secondsToExpire
gets set to a negative value and what we see is just that time truncated by the 'mm:ss' format.So I suspect the root cause is finding out how
secondsToExpire
becomes negative.