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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix(hmr): prevent showing NaNms when startMsSinceEpoch is null
  • Loading branch information
Baptist Hecht committed May 20, 2025
commit 6a92295d7e1d0792c28b9e6d6561a33baf39b5e2
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function tryApplyUpdatesWebpack(
if (!isUpdateAvailable() || !canApplyUpdates()) {
resolvePendingHotUpdateWebpack()
dispatcher.onBuildOk()
reportHmrLatency(sendMessage, [], webpackStartMsSinceEpoch!, Date.now())
reportHmrLatency(sendMessage, [], webpackStartMsSinceEpoch, Date.now())
return
}

Expand Down Expand Up @@ -181,7 +181,7 @@ function tryApplyUpdatesWebpack(
reportHmrLatency(
sendMessage,
updatedModules,
webpackStartMsSinceEpoch!,
webpackStartMsSinceEpoch,
Date.now()
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ declare global {
export default function reportHmrLatency(
sendMessage: (message: string) => void,
updatedModules: ReadonlyArray<string | number>,
startMsSinceEpoch: number,
startMsSinceEpoch: number | null,
endMsSinceEpoch: number,
hasUpdate: boolean = true
) {
const latencyMs = endMsSinceEpoch - startMsSinceEpoch
console.log(`[Fast Refresh] done in ${latencyMs}ms`)
if (startMsSinceEpoch === null) {
return;
}
const latencyMs = endMsSinceEpoch - startMsSinceEpoch;
if (!isNaN(latencyMs)) {
console.log(`[Fast Refresh] done in ${latencyMs}ms`);
}
if (!hasUpdate) {
return
}
Expand Down
Loading
0