-
Notifications
You must be signed in to change notification settings - Fork 143
Labels
[Plugin] Optimization DetectiveIssues for the Optimization Detective pluginIssues for the Optimization Detective plugin[Type] BugAn existing feature is brokenAn existing feature is broken
Milestone
Description
Bug Description
I just noticed in Chrome that when I open a link in a new tab (in the background), the callback passed to onLCP() in web-vitals.js is never invoked, this causes the detection logic to await indefinitely at:
performance/plugins/optimization-detective/detect.js
Lines 657 to 676 in 47eef00
| // Obtain at least one LCP candidate. More may be reported before the page finishes loading. | |
| await new Promise( ( resolve ) => { | |
| onLCP( | |
| /** | |
| * Handles an LCP metric being reported. | |
| * | |
| * @param {LCPMetric|LCPMetricWithAttribution} metric | |
| */ | |
| ( metric ) => { | |
| lcpMetricCandidates.push( metric ); | |
| resolve(); | |
| }, | |
| { | |
| // This avoids needing to click to finalize LCP candidate. While this is helpful for testing, it also | |
| // ensures that we always get an LCP candidate reported. Otherwise, the callback may never fire if the | |
| // user never does a click or keydown, per <https://github.com/GoogleChrome/web-vitals/blob/07f6f96/src/onLCP.ts#L99-L107>. | |
| reportAllChanges: true, | |
| } | |
| ); | |
| } ); |
I wonder if this is an intentional behavior for browsers to not report LCP in this situation.
Steps to reproduce
- Enable
WP_DEBUG - Click a link to open a page in a new tab (in the backgroind)
- Open the tab
- See that the last log entry is "Proceeding with detection", whereas it is expected last log entry after the page load is "Current URL Metric".
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Plugin] Optimization DetectiveIssues for the Optimization Detective pluginIssues for the Optimization Detective plugin[Type] BugAn existing feature is brokenAn existing feature is broken
Type
Fields
Give feedbackNo fields configured for Bug.
Projects
Status
Done 😃