Skip to content

Commit 3a88220

Browse files
authored
distinguish empty (#158)
1 parent c60a946 commit 3a88220

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/performance/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,12 +122,12 @@ class TracePerf {
122122
this.INP();
123123
this.CLS();
124124
setTimeout(() => {
125-
this.coreWebMetrics.fmpTime = Math.floor(FMP.fmpTime) || 0;
125+
this.coreWebMetrics.fmpTime = isNaN(FMP.fmpTime) ? -1 : Math.floor(FMP.fmpTime);
126126
}, 5000);
127127
}
128128
private CLS() {
129129
if (!isLayoutShiftSupported()) {
130-
return this.coreWebMetrics.clsTime = 0;
130+
return this.coreWebMetrics.clsTime = -1;
131131
}
132132
let partValue = 0;
133133
let entryList: LayoutShift[] = [];
@@ -169,7 +169,7 @@ class TracePerf {
169169
}
170170
private LCP() {
171171
if (!isLargestContentfulPaintSupported()) {
172-
return this.coreWebMetrics.lcpTime = 0;
172+
return this.coreWebMetrics.lcpTime = -1;
173173
}
174174
prerenderChangeListener(() => {
175175
const visibilityObserver = getVisibilityObserver();

0 commit comments

Comments
 (0)