-
Notifications
You must be signed in to change notification settings - Fork 488
Closed
Description
When using the web-vitals library to track the Largest Contentful Paint (LCP) metric in a Single Page Application (SPA), we encounter an issue where the LCP entry element is lost upon changing routes. This problem arises because the web-vitals library captures the LCP metric based on the elements rendered on the page at the time of measurement.
In SPAs, content is often loaded dynamically, and when navigating to a new route, the relevant content may not be fully rendered or may change, causing the library to lose track of the largest contentful element. As a result, the reported LCP value may not accurately reflect the user experience, leading to misleading performance metrics.
How to reproduce
- Create any default SPA (Vite etc)
- Start listerning onLCP (web-vitals or web-vitals/attribution)
- Change route before the scroll on any other interaciton
Metadata
Metadata
Assignees
Labels
No labels