Skip to content

Commit d0914a3

Browse files
logaretmclaude
andcommitted
fix(browser-utils): Remove dead FCP instrumentation code
Remove `addFcpInstrumentationHandler`, `instrumentFcp`, and `_previousFcp` which were added to support FCP streamed spans but are no longer called after FCP spans were removed from the implementation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 80669b9 commit d0914a3

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

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

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { onCLS } from './web-vitals/getCLS';
44
import { onINP } from './web-vitals/getINP';
55
import { onLCP } from './web-vitals/getLCP';
66
import { observe } from './web-vitals/lib/observe';
7-
import { onFCP } from './web-vitals/onFCP';
87
import { onTTFB } from './web-vitals/onTTFB';
98

109
type InstrumentHandlerTypePerformanceObserver =
@@ -17,7 +16,7 @@ type InstrumentHandlerTypePerformanceObserver =
1716
// fist-input is still needed for INP
1817
| 'first-input';
1918

20-
type InstrumentHandlerTypeMetric = 'cls' | 'lcp' | 'ttfb' | 'inp' | 'fcp';
19+
type InstrumentHandlerTypeMetric = 'cls' | 'lcp' | 'ttfb' | 'inp';
2120

2221
// We provide this here manually instead of relying on a global, as this is not available in non-browser environements
2322
// And we do not want to expose such types
@@ -115,8 +114,6 @@ let _previousCls: Metric | undefined;
115114
let _previousLcp: Metric | undefined;
116115
let _previousTtfb: Metric | undefined;
117116
let _previousInp: Metric | undefined;
118-
let _previousFcp: Metric | undefined;
119-
120117
/**
121118
* Add a callback that will be triggered when a CLS metric is available.
122119
* Returns a cleanup callback which can be called to remove the instrumentation handler.
@@ -166,14 +163,6 @@ export function addInpInstrumentationHandler(callback: InstrumentationHandlerCal
166163
return addMetricObserver('inp', callback, instrumentInp, _previousInp);
167164
}
168165

169-
/**
170-
* Add a callback that will be triggered when a FCP metric is available.
171-
* Returns a cleanup callback which can be called to remove the instrumentation handler.
172-
*/
173-
export function addFcpInstrumentationHandler(callback: (data: { metric: Metric }) => void): CleanupHandlerCallback {
174-
return addMetricObserver('fcp', callback, instrumentFcp, _previousFcp);
175-
}
176-
177166
export function addPerformanceInstrumentationHandler(
178167
type: 'event',
179168
callback: (data: { entries: ((PerformanceEntry & { target?: unknown | null }) | PerformanceEventTiming)[] }) => void,
@@ -269,15 +258,6 @@ function instrumentInp(): void {
269258
});
270259
}
271260

272-
function instrumentFcp(): StopListening {
273-
return onFCP(metric => {
274-
triggerHandlers('fcp', {
275-
metric,
276-
});
277-
_previousFcp = metric;
278-
});
279-
}
280-
281261
function addMetricObserver(
282262
type: InstrumentHandlerTypeMetric,
283263
callback: InstrumentHandlerCallback,

0 commit comments

Comments
 (0)