File tree Expand file tree Collapse file tree 2 files changed +4
-18
lines changed
packages/tracing/src/browser Expand file tree Collapse file tree 2 files changed +4
-18
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ export class MetricsInstrumentation {
2121 private _performanceCursor : number = 0 ;
2222 private _lcpEntry : LargestContentfulPaint | undefined ;
2323 private _clsEntry : LayoutShift | undefined ;
24- private _reportLCP : ReturnType < typeof getLCP > ;
2524
2625 public constructor ( private _reportAllChanges : boolean = false ) {
2726 if ( ! isNodeEnv ( ) && global && global . performance && global . document ) {
@@ -44,12 +43,6 @@ export class MetricsInstrumentation {
4443
4544 logger . log ( '[Tracing] Adding & adjusting spans using Performance API' ) ;
4645
47- // `addPerformanceEntries` should be called on transaction.finish
48- // If we are finishing a transaction, we should force report the LCP.
49- if ( this . _reportLCP ) {
50- this . _reportLCP ( true ) ;
51- }
52-
5346 const timeOrigin = msToSec ( browserPerformanceTimeOrigin ) ;
5447
5548 let responseStartTimestamp : number | undefined ;
@@ -230,7 +223,7 @@ export class MetricsInstrumentation {
230223
231224 /** Starts tracking the Largest Contentful Paint on the current page. */
232225 private _trackLCP ( ) : void {
233- this . _reportLCP = getLCP ( metric => {
226+ getLCP ( metric => {
234227 const entry = metric . entries . pop ( ) ;
235228 if ( ! entry ) {
236229 return ;
Original file line number Diff line number Diff line change @@ -34,13 +34,10 @@ export interface LargestContentfulPaint extends PerformanceEntry {
3434
3535const reportedMetricIDs : Record < string , boolean > = { } ;
3636
37- export const getLCP = (
38- onReport : ReportHandler ,
39- reportAllChanges ?: boolean ,
40- ) : ReturnType < typeof bindReporter > | undefined => {
37+ export const getLCP = ( onReport : ReportHandler , reportAllChanges ?: boolean ) : void => {
4138 const visibilityWatcher = getVisibilityWatcher ( ) ;
4239 const metric = initMetric ( 'LCP' ) ;
43- let report : ReturnType < typeof bindReporter > | undefined ;
40+ let report : ReturnType < typeof bindReporter > ;
4441
4542 const entryHandler = ( entry : PerformanceEntry ) : void => {
4643 // The startTime attribute returns the value of the renderTime if it is not 0,
@@ -69,9 +66,7 @@ export const getLCP = (
6966 po . takeRecords ( ) . map ( entryHandler as PerformanceEntryHandler ) ;
7067 po . disconnect ( ) ;
7168 reportedMetricIDs [ metric . id ] = true ;
72- if ( report ) {
73- report ( true ) ;
74- }
69+ report ( true ) ;
7570 }
7671 } ;
7772
@@ -84,6 +79,4 @@ export const getLCP = (
8479
8580 onHidden ( stopListening , true ) ;
8681 }
87-
88- return report ;
8982} ;
You can’t perform that action at this time.
0 commit comments