(React) Pomodoro Clock Error Help (tests 12, 13, 15)

Hello all, I recently finished the Pomodoro clock and it runs exactly as it should, the same as the one provided by FCC. However, I keep getting:

Cannot read property ‘1’ of null
TypeError: Cannot read property ‘1’ of null

For tests 12, 13, 15, but NOT 14.

Pen (using React):

The relevant code is possibly the function starting at line 92 and line 174.

I can’t figure out if its a problem with my id labeling, conditional rendering, or the algorithm itself.

When the timer reaches 00:00 should I just wholly stop the timer with clearInterval() and start a new interval?

1 Like
  • There is a problem in the clock … while it was running during the Break time, I paused it then tried to increase session time. It increased time but the element with the id="timer-label" still showing the Break word while it should be Session.

  • There is something else (in my opinion it’s not a problem but in case you need to change it) when the clock is running I can’t change session length or break length and this is good but if I’s working for while and I paused it, trying to change the length of break it changes but without resetting the clock to it’s default state. However if I changed the session length while it’s paused this resets it to default state.

2 Likes

Thank you for your feedback, however to your first point, if you run the Pomodoro Clock provided as an example by FCC, if you pause during the Break and increase Session time, the FCC Clock ALSO doesn’t change to Session but stays as Break.

You did however made me realize I was making an error in updating the time correctly while the timer is paused.

However I am still getting the following errors:

  1. When a session countdown reaches zero (NOTE: timer MUST reach 00:00), and a new countdown begins, the element with the id of “timer-label” should display a string indicating a break has begun.

  2. When a session countdown reaches zero (NOTE: timer MUST reach 00:00), a new break countdown should begin, counting down from the value currently displayed in the id="break-length’

  3. When a break countdown reaches zero (NOTE: timer MUST reach 00:00), a new session countdown should begin, counting down from the value currently displayed in the id=“session-length” element.

All of the above have the error code:

Cannot read property ‘1’ of null
TypeError: Cannot read property ‘1’ of null

I’m not sure why this is, because the timer-label obviously does update with a string for break, and the timer DOES reach 00:00 no problem.

1 Like

@UCDTtbot
sorry I didn’t get notified that you replied to me … as you didn’t mention me in your reply.

Yes that is what I meant… in the example that FCC provides the word break stays while increasing session… but the increased time not added to the break length… and this was happening in your machine.

I see now you have fixed it, Great work
I will try to check your project again, I hope I can be helpful.

1 Like

@UCDTtbot
here is a problem:

  • the minutes showing one zero “0” while it should always be two “00”.
    I think this is the problem in your app fix it and try to pass the tests again.

pomodoro%20problem