Fix Failed to execute 'measure' on 'Performance' error (#32823)

When `startTime` still has its initial value of `-1.1` we must not call
`logComponentMount`. This can occur when rendering a `'next/dynamic'`
component with `{ssr: false}` in a client component, for example.
Unfortunately, I didn't manage to reproduce this scenario in a unit
test.
This commit is contained in:
Hendrik Liebau
2025-04-07 10:13:34 -04:00
committed by GitHub
parent 58c1f36c29
commit d18aff5c8e
+2 -2
View File
@@ -3756,7 +3756,7 @@ function commitPassiveMountOnFiber(
) {
// Log the reappear in the render phase.
const startTime = ((finishedWork.actualStartTime: any): number);
if (endTime - startTime > 0.05) {
if (startTime >= 0 && endTime - startTime > 0.05) {
logComponentReappeared(finishedWork, startTime, endTime);
}
if (
@@ -3861,7 +3861,7 @@ function commitPassiveMountOnFiber(
if (isMount) {
// Log the mount in the render phase.
const startTime = ((finishedWork.actualStartTime: any): number);
if (endTime - startTime > 0.05) {
if (startTime >= 0 && endTime - startTime > 0.05) {
logComponentMount(finishedWork, startTime, endTime);
}
}