Menu

LCP lands in the same millisecond as first paint on all 76 of our pages, and our only layout shift is 58px of header
📰

LCP lands in the same millisecond as first paint on all 76 of our pages, and our only layout shift is 58px of header

DEV Community: nextjs·Daniel Pertu·4 days ago
#ggGM1lLk
#devtonextjs#devto#dev#pages#element
Reading 0:00
15s threshold

I have measured the bytes this site ships, three different ways . I had never measured when anything appears. So: a PerformanceObserver installed before the document exists, over all 76 public pages of Nakodo , with the HTTP cache off.

await page . cdp ( "Network.setCacheDisabled" , { cacheDisabled : true } ) ; await page . cdp ( "Page.addScriptToEvaluateOnNewDocument" , { source : ` new PerformanceObserver(l => { for (const e of l.getEntries()) { window.__m.lcp = e.startTime; window.__m.lcpEl = e.element ? e.element.tagName + "." + e.element.className : "(none)"; window.__m.lcpSize = e.size; } }).observe({ type: "largest-contentful-paint", buffered: true }); new PerformanceObserver(l => { for (const e of l.getEntries()) if (!e.hadRecentInput) { window.__m.cls += e.value; window.__m.shifts++; } }).observe({ type: "layout-shift", buffered: true }); ` } ) ;

Enter fullscreen mode

Exit fullscreen mode

Two details that decide whether this works at all.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.