diff --git a/src/lib/bindReporter.ts b/src/lib/bindReporter.ts index 7063a6f7..df60865b 100644 --- a/src/lib/bindReporter.ts +++ b/src/lib/bindReporter.ts @@ -35,7 +35,7 @@ export const bindReporter = ( thresholds: MetricRatingThresholds, reportAllChanges?: boolean, ) => { - let prevValue: number = -1; + let prevValue: number; let delta: number; return (forceReport?: boolean) => { if (metric.value >= 0) { @@ -46,7 +46,7 @@ export const bindReporter = ( // value exists (which can happen in the case of the document becoming // hidden when the metric value is 0). // See: https://github.com/GoogleChrome/web-vitals/issues/14 - if (delta || prevValue < 0) { + if (delta || prevValue === undefined) { prevValue = metric.value; metric.delta = delta; metric.rating = getRating(metric.value, thresholds);