Repository navigation
fix(generator): size the split hero and preload eager code heroes - #1674
Merged
gregpriday merged 4 commits intoNov 28, 2026
Merged
Conversation
…heroes - Give Foundation's hero.split picture the sizes of its column, in both committed releases, and re-pin the lock - Read a code placement's eager picture and its written sizes for the head's preload, in place of the one hard-coded hero - Walk code placements in the first section, inside designs too, and leave their slot content alone
…ly loads it - Read the markup in order, skipping expressions, strings and comments, and decline blocks, other components' content, an earlier picture, attributes that change the picture, and properties the script renames - End the walk with no preload after code that loads a picture eagerly in a way the head cannot read - Leave everything inside a code placement out of the first section's walk
…reload
- Decline a bare or escaped sizes, a {@const}, comments in the image expression, logical assignments to the property and a helper renamed to thumbnail
- End the walk after code that has a picture of its own the head cannot read
- Test a flag the page never hands, slot content code never shows, and a renamed helper
…() statement - Stop the properties' destructuring at its statement, so an earlier destructuring of something else is never read as them - Leave commented-out markup out of the check for a code placement's own picture - Test a native picture before the section's next one, and a property taken from elsewhere
gregpriday
force-pushed
the
bugfix/issue-1486-hero-image-preload-hardcodes-100vw-on
branch
from
November 28, 2026 10:12
d9afc20 to
8b0a46d
Compare
gregpriday
deleted the
bugfix/issue-1486-hero-image-preload-hardcodes-100vw-on
branch
November 28, 2026 10:20
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.
Foundation's split hero showed its picture in a 7/12 column from desktop up, yet its
<img>,<source>s and the head's preload all said100vw, so a 1440px screen fetched a full-width copy for a picture about 658px wide. The preload also knew only that one component by pack and ID, so a project's own code hero, or any other pack's, got no preload at all.Resolves #1486
Changes
hero.splitpassessizes="(min-width: 1024px) 59vw, 100vw"to its picture in both committed releases (foundation,foundation-alt), andresources/packs.lock.jsonis re-pinned. 59vw is 7/12 rounded up. It holds for the media-start layout too, and it is an upper estimate, since the container's maximum width is a token a site can change.heroImageis gone. A code placement in the first section counts in its turn, on the page or inside a design.eagerCodeImage(src/generator/checks.ts) reads its source, and the head asks for the picture with thesizesthe markup writes (none means the runtime's100vw). It needs all of these:runtime/Image.svelteunder any name, as itself, a copy with settings added, orthumbnail(...);eager,eager={true}, oreager={so_eager}where the page hands the flag);{#key}and every other component's content, with no picture before it;sizesis a plain written list.sizes, a renamed or shadowed property, flag or helper) gets no preload. Code that may load a picture eagerly in a way the head cannot read ends the walk with none, rather than preloading a later picture than the one the page loads first.shownOfis shared withshowsWithSoImage, which now also declines computed keys such as['sources']in a copy.Component source and the release lock
The source change is in siteorigin/builder-components#59, based on
feat/builder-997-editor-hookslike #1562 and #1598. As there, the releases were edited directly rather than rebuilt, andbuilderComponentsCommitis unchanged. The committedhero.splitalso carries the #1432 print rule, which the component source still lacks.Testing
tests/unit/picture-markup.test.ts:it.failsrelease gap, now an ordinary test.tests/unit/generator.test.ts: the split hero's emitted tag carries the sizes. Thefoundation-altassertion now expects the source's own sizes, and the remaining release gap is narrowed to testimonial portraits.src/generator/index.tswere rerun after rebasing ontodevelop.Left open
eagerCodeImageis a token-level reader, not Svelte's parser, which would pull the compiler into the renderer bundle. Deliberately adversarial sources can still fool it, such as an import-looking line inside a multi-line script string, a regex literal containing{/if}, or<svelte:element this={'img'}>before the picture.eager={false}on a code picture with a chosen image ends the walk with no preload, even though a later picture would have been safe to preload.hero.screenshotandcontent.mediawrite nosizes, so they are now preloaded at the runtime's100vw, matching their bodies.block.featureis not readable and gets no preload.