Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
philipwalton committed Sep 27, 2024
1 parent ed35189 commit 87d8406
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/bindReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const bindReporter = <MetricName extends MetricType['name']>(
thresholds: MetricRatingThresholds,
reportAllChanges?: boolean,
) => {
let prevValue: number = -1;
let prevValue: number;
let delta: number;
return (forceReport?: boolean) => {
if (metric.value >= 0) {
Expand All @@ -46,7 +46,7 @@ export const bindReporter = <MetricName extends MetricType['name']>(
// 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);
Expand Down

0 comments on commit 87d8406

Please sign in to comment.