8000 fix(hmr): avoid showing NaNms when startMsSinceEpoch is null by baptisthecht · Pull Request #79400 · vercel/next.js · GitHub
[go: up one dir, main page]

Skip to content

fix(hmr): avoid showing NaNms when startMsSinceEpoch is null #79400

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

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from

Conversation

baptisthecht
Copy link

What?

Fixes an issue where the log message displays [Fast Refresh] done in NaNms.
Screenshot

Why?

This happens because startMsSinceEpoch can be null, but it was being force-cast with a non-null assertion (!), leading to invalid latency calculation.

How?

Improved the type safety by explicitly checking:

  • That startMsSinceEpoch is defined
  • That the computed latencyMs is a valid number

Copy link
changeset-bot bot commented May 20, 2025

⚠️ No Changeset found

Latest commit: 6a92295

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@baptisthecht baptisthecht changed the title fix(hmr): prevent showing NaNms when startMsSinceEpoch is null fix(hmr): avoid showing NaNms when startMsSinceEpoch is null May 20, 2025
Copy link
Member
@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

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

Thanks for checking this out.

This is already being worked on in #79294.
Note that the bug might actually be that we call reportHmrLatency while startMsSinceEpoch is still null

7B4A

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

Successfully merging this pull request may close these issues.

3 participants
0