Repository navigation
perf(images): 1.5.0 — thumbnails stop downloading the original - #17
Merged
Merged
Conversation
`RelatedArticles` and `BentoGrid` both painted a card with a raw
`<img src={sourceFile}>`, so the browser fetched the original at full
resolution to fill it. On endsights.com/roblox-tycoon-games that was
3.905 MB for three 379x237 thumbnails — two of the sources are 1.9 MB
1536px JPGs. Adellion had already hit the same thing on its homepage
(113 MB of full-resolution JPGs) and worked around it by leaving
`backgroundImage` unset and rendering its own `next/image` in children.
Both now render `next/image` with `fill` and a `sizes` hint matching the
component's own grid, plus an `imageSizes` prop for consumers in a
narrower container. `next` is already a peer dependency, and every
consumer transpiles the package, so nothing new ships.
Measured A/B on a local endsights production build, one harness, only
these two files swapped:
related-image bytes 3.905 MB -> 0.014 MB
images loaded 3/3 -> 3/3
intrinsic width painted
into a 379px box 1536 px -> 640 px
`alt` on the related-card image is now `""`. The card's own `<h3>`
carries the title directly below it, so a matching alt read the same
string to a screen reader twice.
Adds the first tests either component has ever had — the absence of
them is why the suite stayed green through the original defect. They
pin the property that produced the saving (narrow candidates plus a
`sizes` hint, never the source file at its own URL) rather than the
identity of the component providing it; 8 of the 11 fail when the
sources are reverted to `main`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
…nails # Conflicts: # package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
RelatedArticlesandBentoGrideach painted a card with a raw<img src={sourceFile}>, so the browser downloaded the original at full resolution to fill it. Both now usenext/imagewithfilland asizeshint matching the component's own grid, plus an optionalimageSizesprop for a consumer rendering into a narrower container.nextis already a peer dependency (^16.2.5) and every consumer setstranspilePackages: ['@isimplifyme/ui'], so nothing new ships.Measured
Controlled A/B on a local endsights production build — one harness, identical scroll, only these two files swapped in
node_modules:<img>)The optimizer returns a 640×427 WebP at 4,146 bytes for a 1,984,124-byte source. Verified in both headless-shell and a headed browser; screenshot confirms the cards render.
Adellion had already hit the same defect on its homepage — 113 MB of full-resolution JPGs — and worked around it by leaving
backgroundImageunset and rendering its ownnext/imageinchildren. That workaround can come out once this lands.Tests
The first tests either component has ever had. Their absence is why a green 45/45 suite stayed green right through the original defect.
They pin the property that produced the saving — the browser is offered narrow candidates and a
sizeshint, never the source file at its own URL — rather than the identity of the component providing it. 8 of the 11 fail when the two sources are reverted tomain; the 3 that pass are the unchanged negative cases (no image, empty list, no background).Full suite 56/56,
tsc --noEmitclean.Behavior changes to be aware of
alton the related-card image is now"". The card's<h3>carries the title directly below it, so a matchingaltread the same string to a screen reader twice. The image is decorative; the link's accessible name is unchanged.next/imagethrows on a remote URL whose hostname isn't inimages.remotePatterns. Checked all three consumers that use these components (endsights, simplified-media, adellion): 171 stringfeatured_mediavalues, zero remote — everyimageresolves to a local/images/...path, so nothing breaks today. If a future post ever carries a remotefeatured_media, that consumer will needremotePatterns.Not in this PR
bento-grid.tsxaccentStyles.hazardstill uses amberrgba(255,164,26)from before Adellion's cyan rebrand.Publishing is tag-triggered (
v*), so merging this does not publish 1.5.0.🤖 Generated with Claude Code