perf(storefront): make the homepage hero paint immediately#287
What happened
Lighthouse 13 (mobile, Slow 4G, 4x CPU) scores the homepage at 53 while product pages score 92+. LCP is the hero carousel image at 6.2s, and the network is not the problem:
- TTFB 158ms, hero image download 158ms
- 1,438ms element render delay waiting on the main thread
- Main thread during load: 1,517ms style & layout, 1,334ms script evaluation
- Long tasks:
client.D6_eju8K.js429ms, PostHogarray.js199ms, inline doc script 182ms - The active hero
<img>has nofetchpriority="high"(Lighthouse lcp-discovery checklist flags this) - The hero also fires twice at different widths (480w then 360w at 1,361ms), suggesting a srcset/DPR mismatch
12 card-add-button islands hydrate eagerly via client="load" even though most sit below the fold.
What I expect
The hero should be the first thing painted, not the last.
Plan
- Add
fetchpriority="high"to the active hero slide img and<link rel="preload" as="image">it. - Check why a second 360w variant is requested late; align srcset/sizes with the actual rendered slot.
- Switch below-fold islands (
card-add-button, brand strip bits) toclient="visible". - Re-run Lighthouse mobile on
/.
Acceptance criteria
- Homepage mobile performance score >= 90
- Homepage LCP < 2.5s under Lighthouse mobile throttling
- CLS stays at 0
- Hero image has exactly one network request at the correct width