Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating initial time won't update the timer #77

Open
eddsaura opened this issue Dec 17, 2021 · 7 comments
Open

Updating initial time won't update the timer #77

eddsaura opened this issue Dec 17, 2021 · 7 comments

Comments

@eddsaura
Copy link

Hey wassup,

I am changing the initial time when a state is changing ( so it should be re rendernig ) but is not updating to the new time.

The logic behind is, we have an event with start date and end date. So, when the event is not started it shows the timer to the start of the event, and when the event is running it should show the time left until the end of said event.

Also, if you are in another tab the countdown seems to stop, it could be easily fixable checking the time again, but since changing the initial time won't update it's difficult.

@thibaultboursier
Copy link
Owner

Hey @eddsaura,

Thanks for opening this issue.

Could you create a reproductible example of this issue, for example on https://stackblitz.com/?

Thanks.

@sasweb
Copy link

sasweb commented Mar 16, 2022

Hi @thibaultboursier, I have a similar issue as @eddsaura I guess.
Here's a demo: https://stackblitz.com/edit/react-dpshem?file=src/App.js

Issue 1: click "Update initial to 20", see nothing happens. Expected from my side: initialTime is set to 20.
Issue 2: click "Add 20" and afterwards "Start". See 20 is added to the initial time but removed as soon as timer is started. This is for me even more critical and feels related.

What do you think?

Thanks!

@thibaultboursier
Copy link
Owner

Hello @Pawelsas,

Thanks for your comment and your demo. I'm going to check that.

@eddsaura
Copy link
Author

Sorry! I finally had to do it myself. Thanks for answering tho! <3

@chaoli23
Copy link

same issue, any workaround?

@andy-todd-dev
Copy link

same issue, any workaround?

This issue has been fixed on the 'develop' branch (although a reset is required before a new initialTime is reflected). Unfortunately there is no release, but I've used it without issue.

@danielrobertson
Copy link

danielrobertson commented Jul 10, 2022

+1. Thank you for raising, @eddsaura! Came here to discuss the same issue.

My use case is building a Pomodoro timer in React where I want to reset the timer back to various initialTime using a useState variable within the component, but noticing initialTime does not change after its initial set value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants