perf: lazy-load MDX images - #1975
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
marcleblanc2
force-pushed
the
marc/perf/lazy-load-images
branch
from
September 17, 2026 02:32
20f4f95 to
974b0fc
Compare
This comment has been minimized.
This comment has been minimized.
marcleblanc2
force-pushed
the
marc/perf/lazy-load-images
branch
from
September 18, 2026 03:01
de39caa to
3369fd5
Compare
marcleblanc2
marked this pull request as ready for review
September 18, 2026 03:21
marcleblanc2
enabled auto-merge (squash)
September 18, 2026 03:34
valerybugakov
approved these changes
Sep 18, 2026
ZoomableImage renders every doc image eagerly, so a long page downloads every screenshot on it before first paint. loading="lazy" defers the ones below the fold until the reader scrolls near them. Amp-Thread-ID: https://ampcode.com/threads/T-01a0b274-3173-77ed-8f71-82301b157a16 Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a0b274-3173-77ed-8f71-82301b157a16 Co-authored-by: Amp <amp@ampcode.com>
marcleblanc2
force-pushed
the
marc/perf/lazy-load-images
branch
from
September 18, 2026 04:58
3369fd5 to
f6911a6
Compare
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.
Problem
ZoomableImagerenders every doc image as an eager<img>, so a long page downloads every screenshot on it before first paintSolution
loading="lazy"so images below the fold wait until the reader scrolls near themVerification
Measured on the preview deploy:
/code-navigation/auto-indexing(16 images) goes from 2.8 MB of image bytes beforeloadto 28 KBShort pages are unchanged, since Chrome prefetches lazy images within ~1250 px of the viewport
Verified
npx tsc --noEmitandnpm run lint, no new warnings