File tree 2 files changed +3
-9
lines changed
packages/browser-utils/src/metrics
2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ export function startTrackingWebVitals({ recordClsStandaloneSpans }: StartTracki
92
92
fidCleanupCallback ( ) ;
93
93
lcpCleanupCallback ( ) ;
94
94
ttfbCleanupCallback ( ) ;
95
- clsCleanupCallback ( ) ;
95
+ clsCleanupCallback && clsCleanupCallback ( ) ;
96
96
} ;
97
97
}
98
98
Original file line number Diff line number Diff line change @@ -23,16 +23,12 @@ import { onHidden } from './web-vitals/lib/onHidden';
23
23
* Once either of these events triggers, the CLS value is sent as a standalone span and we stop
24
24
* measuring CLS.
25
25
*/
26
- export function trackClsAsStandaloneSpan ( ) : ( ) => void {
26
+ export function trackClsAsStandaloneSpan ( ) : void {
27
27
let standaloneCLsValue = 0 ;
28
28
let standaloneClsEntry : LayoutShift | undefined ;
29
29
30
- // Cleanup for standalone span mode is handled in this function.
31
- // Returning a no-op for API compatibility with `_trackCLS` measurement mode (saves some bytes)
32
- const cleanupNoop = ( ) => undefined ;
33
-
34
30
if ( ! supportsLayoutShift ( ) ) {
35
- return cleanupNoop ;
31
+ return ;
36
32
}
37
33
38
34
let sentSpan = false ;
@@ -68,8 +64,6 @@ export function trackClsAsStandaloneSpan(): () => void {
68
64
typeof unsubscribe === 'function' && unsubscribe ( ) ;
69
65
} ) ;
70
66
} , 0 ) ;
71
-
72
- return cleanupNoop ;
73
67
}
74
68
75
69
function sendStandaloneClsSpan ( clsValue : number , entry : LayoutShift | undefined ) {
You can’t perform that action at this time.
0 commit comments