Repository navigation
perf(docs): load showcase film tiles only when they are near the screen - #7507
Merged
Merged
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
Contributor
There was a problem hiding this comment.
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 asrcand hydration matches. A tile getssrcandautoPlayonly 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.nearis 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,
srcstays 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.
Merged
3 of 4 tasks
Merged
4 of 6 tasks
This branch was successfully deployed
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 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.jsxchanges; 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:
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.