Unverified Commit 4d13d671 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Add check for startLatency in fast refresh (#26417)

parent 075139a2
...@@ -173,16 +173,20 @@ function handleErrors(errors) { ...@@ -173,16 +173,20 @@ function handleErrors(errors) {
} }
} }
let startLatency = undefined
function onFastRefresh(hasUpdates) { function onFastRefresh(hasUpdates) {
DevOverlay.onBuildOk() DevOverlay.onBuildOk()
if (hasUpdates) { if (hasUpdates) {
DevOverlay.onRefresh() DevOverlay.onRefresh()
} }
const latency = Date.now() - startLatency if (startLatency) {
console.log(`[Fast Refresh] done in ${latency}ms`) const latency = Date.now() - startLatency
if (self.__NEXT_HMR_LATENCY_CB) { console.log(`[Fast Refresh] done in ${latency}ms`)
self.__NEXT_HMR_LATENCY_CB(latency) if (self.__NEXT_HMR_LATENCY_CB) {
self.__NEXT_HMR_LATENCY_CB(latency)
}
} }
} }
...@@ -192,8 +196,6 @@ function handleAvailableHash(hash) { ...@@ -192,8 +196,6 @@ function handleAvailableHash(hash) {
mostRecentCompilationHash = hash mostRecentCompilationHash = hash
} }
let startLatency = undefined
// Handle messages from the server. // Handle messages from the server.
function processMessage(e) { function processMessage(e) {
const obj = JSON.parse(e.data) const obj = JSON.parse(e.data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment