Skip to content

Commit 4b769ff

Browse files
authored
Fix INP durationThreshold bug when set to 0 (#372)
When INP's `durationThreshold` was set to a value of `0`, it would actually ignore all values under 40 ms because the logical (||) operator was used. Use nullish coalescing operator instead to fix this bug.
1 parent 27db8a0 commit 4b769ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/onINP.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export const onINP = (onReport: INPReportCallback, opts?: ReportOpts) => {
206206
// and performance. Running this callback for any interaction that spans
207207
// just one or two frames is likely not worth the insight that could be
208208
// gained.
209-
durationThreshold: opts!.durationThreshold || 40,
209+
durationThreshold: opts!.durationThreshold ?? 40,
210210
} as PerformanceObserverInit);
211211

212212
report = bindReporter(

0 commit comments

Comments
 (0)