Skip to content

perf(home): preload exactly the carousel image the browser renders - #643

Merged
TheMeinerLP merged 1 commit into
mainfrom
perf/home-lcp-image
Nov 22, 2026
Merged

TheMeinerLP merged 1 commit into
mainfrom
perf/home-lcp-image

Conversation

@TheMeinerLP

Copy link
Copy Markdown
Collaborator

Problem

The home page triggered two preloads for the first carousel image. One was hand-written with fetchpriority="high"; the other came from the image component, had no priority and used slightly different breakpoints (767/1023 vs 768/1024). The two could point at different candidates of the same picture, so the browser could fetch the hero image twice while the page was loading.

Approach

The carousel now leaves preloading to the image component and asks it for high priority on the first slide only; the hand-written preload is gone. All six slide types take their sizes from one shared constant, so the preload and the rendered <source> cannot drift apart. The project logo is no longer preloaded.

Proposal: openspec/changes/perf-home-lcp-image (#631).

Result

Production build with the Cloudflare image provider, Lighthouse 12.8.2 mobile, median of 5:

before after
image preloads on /en 2 1 (fetchpriority=high, imagesizes = first <source sizes>)
image requests on load 3 2
LCP discovery insight failing passing
LCP /en 4222 ms 4132 ms
LCP /de 4136 ms 4126 ms

The LCP change is within run-to-run noise; the gain is the removed duplicate fetch.

Tests

A file-reading spec holds the shared sizes constant in every slide; a component spec asserts that only the first slide asks for a high-priority preload and the project logo for none. The emitted <link> itself is server-only and was checked in the built HTML. Tests, quality gate (no rise) and production build pass.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
launchpad 4c7418a Commit Preview URL

Branch Preview URL
Nov 22 2026, 10:58 PM

@TheMeinerLP
TheMeinerLP merged commit 43b0578 into main Nov 22, 2026
14 checks passed
@TheMeinerLP
TheMeinerLP deleted the perf/home-lcp-image branch November 22, 2026 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant