Skip to content

Commit 323b343

Browse files
committed
add guards around report
1 parent 532c68b commit 323b343

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/tracing/src/browser/web-vitals/getCLS.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ export const getCLS = (onReport: ReportHandler, reportAllChanges?: boolean): voi
6767
if (sessionValue > metric.value) {
6868
metric.value = sessionValue;
6969
metric.entries = sessionEntries;
70-
report();
70+
if (report) {
71+
report();
72+
}
7173
}
7274
}
7375
};

packages/tracing/src/browser/web-vitals/getLCP.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@ export const getLCP = (onReport: ReportHandler, reportAllChanges?: boolean): voi
5151
metric.entries.push(entry);
5252
}
5353

54-
report();
54+
if (report) {
55+
report();
56+
}
5557
};
5658

5759
const po = observe('largest-contentful-paint', entryHandler);

0 commit comments

Comments
 (0)