7. Header/hero layout flip and hero image not server-rendered — Medium (PV)
helper/custom-hook/useDevice.jsreturnsnulluntil after mount → every phone first renders the desktop branch.story-header/index.js:31heroImageMinHeight = isMobile ? "184px" : "456px"withtransition: min-height 0.3s→ hero area 456 → 184 → ~271 px on mobile (server HTML containsmin-height:456px).story-header/hero-image/index.jswraps the hero inWithLazy→ hero<picture>absent from server HTML (likely the LCP image).- Measured load-time shift 0.03–0.11.
🛠️ Size hero with CSS aspect-ratio + media queries, remove min-height transition, render hero without WithLazy; review other !isMobile render branches (sidebar, OutOfPageAd).
16 Nov 2026 (DevTools trace, #39): on a mobile PV article the LCP element is a Google ad image at 17.0 s (lab; real users p75 LCP 3.6 s, CLS 0.33), because the article's own hero image is not in the server HTML. Server-rendering the hero with fetchpriority="high" is the main LCP fix.
Code check (16 Nov 2026, tpml upstream/master 70d7bebf): the hero image is client-only because story-templates/story-header/hero-image/index.js:14 wraps it in <WithLazy margin="20px"> (renders nothing on the server; the image appears only after JavaScript runs and an IntersectionObserver fires). No fetchpriority is set anywhere. Fix: render the hero <img> directly on article pages (no WithLazy above the fold) with fetchpriority="high" and explicit width/height.