Skip to content

Commit c800954

Browse files
committed
ci: Fix CLS capture
1 parent 94dea74 commit c800954

File tree

1 file changed

+4
-6
lines changed
  • packages/overhead-metrics/src/vitals

1 file changed

+4
-6
lines changed

packages/overhead-metrics/src/vitals/cls.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ class CLS {
1212
1313
const observer = new PerformanceObserver((list) => {
1414
for (const entry of list.getEntries()) {
15-
if (!entry.hadRecentInput) {
16-
if (window.cumulativeLayoutShiftScore === undefined) {
17-
window.cumulativeLayoutShiftScore = entry.value;
18-
} else {
19-
window.cumulativeLayoutShiftScore += entry.value;
20-
}
15+
if (window.cumulativeLayoutShiftScore === undefined) {
16+
window.cumulativeLayoutShiftScore = entry.value;
17+
} else if (!entry.hadRecentInput) {
18+
window.cumulativeLayoutShiftScore += entry.value;
2119
}
2220
}
2321
});

0 commit comments

Comments
 (0)