Skip to content

fix: handle NaN in build time estimate #5679

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

Merged
merged 1 commit into from
Jan 11, 2023
Merged

Conversation

presleyp
Copy link
Contributor

Fixes #5437

If the estimated time left is 0, we divide by 0 and get NaN, and the max of 0 and NaN is NaN, so it takes an extra step to avoid passing NaN on.

@presleyp presleyp requested a review from a team as a code owner January 11, 2023 20:10
@presleyp presleyp requested review from Kira-Pilot and removed request for a team January 11, 2023 20:10
Math.ceil(dayjs.duration((1 - sinceStart / est) * est).asSeconds()),
0,
)
return isNaN(max) ? 0 : max
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, looking at the ticket, it seems like this will result in a string saying "Up to 0 seconds remaining" which seems a little off to me. What do you think about adjusting the text for this case so it says something like "Finishing up..." or similar instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It actually hits the case that says "Anytime now..." I added a story called StartingZeroEstimate that should show that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

@presleyp presleyp merged commit 1df72ee into main Jan 11, 2023
@presleyp presleyp deleted the 5437/nan-seconds/presleyp branch January 11, 2023 20:56
@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

build time shows NaN seconds remaining
2 participants