Skip to content

Commit a74fec7

Browse files
logaretmclaude
andcommitted
refactor(browser-utils): Share MAX_PLAUSIBLE_INP_DURATION between INP handlers
Export the constant from inp.ts and import it in webVitalSpans.ts to avoid the two definitions drifting apart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7df4cd4 commit a74fec7

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

packages/browser-utils/src/metrics/inp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const ELEMENT_NAME_TIMESTAMP_MAP = new Map<number, string>();
3737
* 60 seconds is the maximum for a plausible INP value
3838
* (source: Me)
3939
*/
40-
const MAX_PLAUSIBLE_INP_DURATION = 60;
40+
export const MAX_PLAUSIBLE_INP_DURATION = 60;
4141
/**
4242
* Start tracking INP webvital events.
4343
*/

packages/browser-utils/src/metrics/webVitalSpans.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ import { WINDOW } from '../types';
2020
import { INP_ENTRY_MAP } from './inp';
2121
import type { InstrumentationHandlerCallback } from './instrument';
2222
import { addClsInstrumentationHandler, addInpInstrumentationHandler, addLcpInstrumentationHandler } from './instrument';
23+
import { MAX_PLAUSIBLE_INP_DURATION } from './inp';
2324
import { listenForWebVitalReportEvents, msToSec, supportsWebVital } from './utils';
2425

25-
// Maximum plausible INP duration in seconds (matches standalone INP handler)
26-
const MAX_PLAUSIBLE_INP_DURATION = 60;
27-
2826
interface WebVitalSpanOptions {
2927
name: string;
3028
op: string;

0 commit comments

Comments
 (0)