Skip to content

perf(docs): load showcase film tiles only when they are near the screen - #7507

Merged
miguel-heygen merged 1 commit into
mainfrom
dmcp/docs-showcase-lazy
Nov 10, 2026
Merged

miguel-heygen merged 1 commit into
mainfrom
dmcp/docs-showcase-lazy

Conversation

@miguel-heygen

Copy link
Copy Markdown
Collaborator

What changes

On the docs Introduction page, the wall of showcase films used to start downloading every film tile the moment the page opened, including tiles far below the screen. Now a tile only gets its video once it is within a short distance of the visible area, plays while it is there, and pauses when it scrolls away. Until then the tile shows its poster image exactly as before.

Nothing about the content, layout or click-through changes. With reduced motion on, tiles still never load a video, as before. Only docs/snippets/docs-video.jsx changes; no media is added to the repo. The Catalog page is untouched.

How it was checked

Docs served locally from this branch and from its base, same machine, same browser, desktop and phone-sized windows:

  • Opening the page requests far fewer film files, and a tile far below the fold makes no request until scrolled near.
  • A tile in range plays, one scrolled far away is paused and plays again when scrolled back.
  • Reduced motion: no tile has a video source.
  • Clicking a tile opens the full film with controls; Back returns to the wall.
  • Screenshots of base and branch are identical on desktop; on the phone-sized window a 36x36 box at the bottom left differs, and it differs the same way between two runs of the base itself.

Not covered

One run per measurement, local dev server rather than a production build, no real GPU, Chrome only. After "Back to all films", tiles that were near the screen earlier load again even if they are now far away (paused, same as before this change).

Size

One file, about 30 lines changed.

@mintlify

mintlify Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
hyperframes 🟢 Ready View Preview Nov 10, 2026, 5:52 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve at 7b7b51f7.

Checked against the full ShowcaseWall at this head:

  • Server render and first client render both start with near = {}, so no tile has a src and hydration matches. A tile gets src and autoPlay only after the observer marks it near.
  • The observer is rebuilt on [reduced, openId]. Opening a film unmounts the wall (the effect returns early on a null ref), and going back remounts it with a fresh observer. near is not in the deps, so the observer isn't torn down every time a tile marks itself near.
  • Reduced motion still wins. The effect returns early, src stays undefined, and the existing reduce-motion effect still stops tiles that are already playing.
  • Pausing on exit is safe for the autoplay path, because pause() clears the element's can-autoplay flag. So a re-rendered tile that is off screen doesn't start playing after the observer's first callback.

Non-blocking: if a visitor turns reduced motion off again, or comes back from an opened film, tiles that were near earlier fetch their card again even if they are now off screen (then pause). The PR body already discloses this.

No "fails without the fix" line needed: this is a perf change, not a bug fix.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit fd0c233 Nov 10, 2026
63 checks passed
@miguel-heygen
miguel-heygen deleted the dmcp/docs-showcase-lazy branch November 10, 2026 20:44
@miguel-heygen miguel-heygen mentioned this pull request Nov 10, 2026
3 of 4 tasks
@heygengenesis heygengenesis Bot mentioned this pull request Nov 12, 2026
4 of 6 tasks

This branch was successfully deployed

1 active deployment
staging - docs — 7b7b51f7 Deployed Nov 10, 2026 by mintlify[bot]
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