Repository navigation
perf(thumbnails): load the thumbnail images on demand - #388
Merged
antobinary merged 1 commit intoNov 18, 2026
Merged
Conversation
germanocaumo
force-pushed
the
perf-thumbnails-lazy
branch
from
November 17, 2026 17:54
8cbf30b to
1d1ee16
Compare
Every slide image in the thumbnail strip was fetched while the player loaded, although only a few are visible. Lazy load them, and give each image the slide's dimensions so the images not loaded yet keep their width: with none, they are 0 wide and the whole strip counts as visible.
germanocaumo
force-pushed
the
perf-thumbnails-lazy
branch
from
November 17, 2026 18:18
1d1ee16 to
ef6937c
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.
What does this PR do?
Loads the thumbnail strip's slide images on demand instead of all of them while the player loads.
Each thumbnail is the slide image itself (an SVG of up to several hundred KB in tldraw recordings), and every one was fetched on load although the strip only shows a few at a time. The images are now
loading="lazy".That alone defers almost nothing (37 of 45 requests still go out): the CSS sets the images' height and leaves the width
auto, so an image not loaded yet is 0 px wide and the whole strip fits in the lazy-loading margin. The images now also get the slide'swidthandheightfromshapes.svg(passed throughbuildThumbnailsand the thumbnail components), which the browser turns into a placeholder aspect ratio until the image loads. Images without valid dimensions are left as before.A CSS-only placeholder (
aspect-ratio: auto 16 / 9on the images) defers the same requests without the plumbing, but slides of another shape then resize as they load, and in Firefox the auto-scroll to the current thumbnail lands off-centre (see the table). Exact sizes keep it centred in every browser.The ≤2.5 PNG slide renderer shows the slide's thumbnail as a placeholder while the full slide loads; after a far seek that thumbnail is now fetched with the slide instead of being already cached.
Also part of #376, which bundles it with a redesign.
How to test
A tldraw recording with 103 thumbnails (45 distinct 4:3 slides), desktop width:
Also compared with develop on recordings from 3.0.27+, 3.0.2–3.0.26, 2.6 (tldraw), ≤2.5 (PNG slides), audio-only and
layout.single, at desktop and phone widths: same thumbnails and thumbnail widths as develop in every case; only fewer images loaded up front on narrow screens.Changelog