Skip to content

perf(docsite): a narrow screen loads the other hero slides only when the visitor uses the reel - #13705

Merged
nynexman4464 merged 2 commits into
mainfrom
nynexman4464/perf/docsite-reel-warm-up-narrow
Nov 24, 2026
Merged

nynexman4464 merged 2 commits into
mainfrom
nynexman4464/perf/docsite-reel-warm-up-narrow

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

Below 1024 px wide, where the hero reel does not advance by itself, the home page no longer loads the fonts and photos of the other four slides after load. It loads the two slides next to the current one when the visitor first moves a touch sideways on the reel or moves keyboard focus to its dots, and again after each change of slide.

No other template fits: this is a performance change in apps/docsite with no new capability and no public API.

User or maintainer impact

  • A visitor on a narrow screen who does not use the reel: a cold first visit downloads 334 KB less (1,794.5 → 1,460.6 KB at 390 by 844), in 20 fewer requests. That is 12 photos (139.5 KB) and 8 font files (194.8 KB) of slides that the visitor never sees.
  • A visitor who scrolls the page with a touch that starts on the hero, or who taps or tabs to a link in the hero text: the same. Those actions load nothing.
  • A keyboard visitor on a narrow screen: the two slides next to the first one load when the focus reaches the dots, before an arrow key moves the reel.
  • A visitor who swipes the reel, the trade: the first swipe can show the new slide before its photos and fonts arrive. Until they arrive, the slide shows the photos of the slide before it, and a fallback font. Before this change the files were loaded after load, so a swipe showed the complete slide at once. See the measured times and the screenshot below.
  • A visitor in a data-saving mode or on a 2G connection, on a narrow screen: the reel loads no slide ahead of need. A slide loads when it shows, as the docsite's other downloads ahead of need do for these visitors.
  • A visitor on a screen 1024 px wide or wider: no change. The page loads every slide after load, as before, with the same requests.
  • Maintainers: the reel's warm-up has two paths: a wide screen loads every slide at the first idle moment, a narrow screen loads slides on use.

Bytes for a cold first visit, on local production builds (next build, then next start) of main at d63c249 and of this branch. Headless Chromium 149, bytes on the wire from the DevTools protocol.

Viewport What the visitor does Before After
390 by 844, 3x, touch Nothing 1,794 KB 1,461 KB
390 by 844, 3x, touch Scrolls with a touch that starts on the hero 1,794 KB 1,461 KB
390 by 844, 3x, touch Swipes the reel once 1,794 KB 1,733 KB
1440 by 900, 1x Nothing 1,737 KB 1,737 KB

A touch row is the row above it plus the requests that the touch starts. A scroll starts none. One swipe loads 273 KB: the slide after and the slide before the first one (6 photos and 6 font files, 212 KB), and after the swipe the next slide over (3 photos, 61 KB). Its fonts are the Butter fonts, which the themes card of the page loads.

The trade, measured. A swipe from the first slide to the second, 0.29 to 0.33 s from touch start to touch end. The downloads start 0.03 to 0.04 s after the touch starts, when it has moved 10 px sideways. Time from the change of slide to the arrival of the second slide's files, in two runs of each throttled case and one run with no throttle:

Network (DevTools emulation) Photos (3) Fonts (2)
No throttle, local server 0.27 s before the slide changes 0.25 to 0.26 s before
Fast 4G Between 0.09 s before and 0.02 s after 0.05 to 0.11 s after
Slow 4G 0.5 to 0.9 s after 1.4 to 1.7 s after

On main the files are in the cache before the swipe in all three cases. The next swipes do better than the first: after each change of slide the page loads the next neighbor while the visitor looks at the new slide.

Slow 4G, 0.37 s after the swipe ends: main on the left, this branch on the right. The branch shows the Matcha slide with the photos of the first slide and a fallback font. The photos are replaced 0.5 to 0.9 s after the swipe, and the font 1.4 to 1.7 s after it.

Slow 4G, 0.36 s after a swipe: main and this branch

Problem and solution fit

  1. Why does it occur? HeroReelProvider loads the fonts and photos of every slide at the first idle moment after load. It does that so that an auto-advance does not show a font flash or a photo that pops in. The effect does not ask whether the reel advances.
  2. Why does it harm the page? Below 1024 px the reel is manual: it moves only on a swipe or a dot. The four other slides are 334 KB of the phone page's 1,794 KB, loaded for a visitor who in most visits does not move the reel.
  3. Why does that matter? It is almost one fifth of the bytes of a cold visit on a phone, on the connections where bytes cost the most, for nothing that the visitor sees.

Each delta maps to that problem:

Delta Why it is needed
hero/HeroThemeReel.tsx, the warm-up effect Loads every slide only where the screen is wide. It runs again when the screen changes between narrow and wide, so a reel that starts to advance has its files. The first render after hydration has the server's answer for the media query, a wide screen: the effect's cleanup cancels that render's idle callback when the browser's answer replaces it.
hero/HeroThemeReel.tsx, warmNeighborsOf On a narrow screen, loads the slide after and the slide before a slide. A slide loads once while the screen stays narrow. The swipe area calls it on the first sideways touch travel of 10 px. The dots call it on keyboard focus. goTo calls it for the slide that a swipe or a dot moves to.
lib/prefersReducedData.ts Its header lists the code that uses it, and the reel is now in that list. warmNeighborsOf returns early when it is true.
hero/HeroThemeReel.tsx, warmAssets The font and photo loading of the old effect, as a function that both paths call. It gives each Image the sizes and the srcset of the card's <img> before the src, as the old effect did.
hero/heroThemeContent.ts The font families move from one flat list to a list for each theme, and slideAssets names the fonts of one slide and the sources of its three photos: the same src, srcset and sizes that its cards render. The flat lists that the wide path loads are built from the same data and are the same as before.
src/__tests__/hero-reel-warm-up.test.tsx, src/__tests__/hero-theme-content.test.ts, src/__tests__/hero-reel-photos.test.tsx, e2e/home-reel-warm-up.spec.ts Tests, described below.

Three choices that a reader can question:

  • Sideways travel, not the touch start. The hero fills the first screen of a phone, so a touch that scrolls the page also starts on the reel. Loading on touch start would load two slides for most visitors who scroll. The cost is 0.02 to 0.04 s of lead time on a swipe.
  • Keyboard focus on the dots, not focus in the hero. The swipe area also holds the hero's links, and a tap on a link can focus it. The dots are the reel's only keyboard control. A press also focuses a dot, and the dots move the reel to the dot that has the focus, so goTo loads the slides for a press. The handler reads :focus-visible to tell the two apart.
  • Two neighbors, not every slide. A swipe or an arrow key moves one slide. A press on a dot can move two or more slides: that slide loads when it shows, as every slide did before the warm-up existed, and its two neighbors load with it. A press on the fourth dot loads slides 3, 4 and 5.

The reason for the wide path is a reel that advances by itself, and its condition is the width, as on main: a wide screen with reduced motion still loads every slide.

No tagalongs, and no change to what a wide screen loads.

The narrow path loads the file that the slide shows. The reel's photos load through the image optimizer, and the browser selects a width from the srcset and the sizes of each card's <img>. slideAssets gives the warm-up those same sources, so the browser selects the same file for the warm-up's Image and for the card. The network log of a 390 by 844 screen at 3x through two swipes (full log), after the first swipe:

  request  matcha-watch.webp        w=750   11.0 KB
  request  matcha-headphones.webp   w=750   13.3 KB
  request  matcha-tumbler.webp      w=256    3.7 KB
  request  y2k-watch.webp           w=750   16.6 KB
  request  y2k-headphones.webp      w=750    8.7 KB
  request  y2k-backpack.webp        w=256    2.7 KB
  request  butter-watch.webp        w=750   29.4 KB
  request  butter-backpack.webp     w=750   24.5 KB
  request  butter-headphones.webp   w=256    7.1 KB
  the reel draws matcha-watch.webp&w=750&q=75       in a 131x106 box; that URL was requested 1 time(s)
  the reel draws matcha-headphones.webp&w=750&q=75  in a 167x122 box; that URL was requested 1 time(s)
  the reel draws matcha-tumbler.webp&w=256&q=75     in a 58x58 box; that URL was requested 1 time(s)

Through load and two swipes the page makes 15 requests for 15 photos, and requests no photo at a second width.

Authority

  • pnpm specs:for --diff origin/main routes no concern claim to the changed lines. The change edits an Effect, so I read the claims of architecture:react-component-runtime that govern one:
    • INV2 (discrete intent stays discrete): the loads on a narrow screen start in the handlers that receive the visitor's action (touch move, focus, and goTo). No effect reacts to interaction state.
    • INV3 (effects synchronize external systems): the one effect syncs the browser's cache with a reel that advances by itself, and its comment says so. It depends on the media query's answer, which is not interaction state.
    • INV5 (resource ownership is complete): the effect cancels its idle callback when it runs again and when the provider unmounts. A test covers each.
    • INV6 (node replacement): the change owns no node.
  • spec:AST-033 and architecture:knowledge-contracts are linked to apps/docsite/**. None of their claims covers when a page loads a font or a photo.
  • The visible behavior change is the trade above, on a narrow screen only. No record covers it. The docsite's owner approved it, and that approval has no public link: fewer bytes for each narrow-screen visit are worth a first swipe that can show a photo or a font arriving. The saving was 491 KB when he first approved. On the current main the reel's photos are smaller, and the saving is 334 KB.

Change and evidence

Red, then green. The new browser test on a production build of main:

  ✘  e2e/home-reel-warm-up.spec.ts:145:7 › at a phone size › the home page requests the photos of another reel slide only after a touch moves sideways on the reel
  ✘  e2e/home-reel-warm-up.spec.ts:208:7 › at a phone size › a press on a dot loads its slide and the two slides next to it
  ✘  e2e/home-reel-warm-up.spec.ts:236:7 › at a phone size › keyboard focus loads the two slides next to the first one at the dots, and nothing at a link
  ✓  e2e/home-reel-warm-up.spec.ts:262:7 › at a desktop size › the home page requests the photos of every reel slide once, with no input

    - Expected  - 4
    + Received  + 4
      Array [
        3,
    -   0,
    -   0,
    -   0,
    -   0,
    +   3,
    +   3,
    +   3,
    +   3,
      ]

On the build of this branch the four tests pass. The numbers are the photos that the page requested for each of the five slides, in the first test.

On a build of this branch in which the warm-up gives an Image only its src, and not the sizes and the srcset of the card, all four tests fail: the page asks for a neighbor's photos at 1080 px, where the browser selects 256 px for a card.

No change at rest. First-screen screenshots of main and of this branch, with the first slide and with the second slide after a dot press and a wait for its files:

Viewport Color mode First slide Second slide
390 by 844 at 3x Light 0 of 2,962,440 pixels differ 0
390 by 844 at 3x Dark 0 0
1440 by 900 at 1x Light 42 of 1,296,000 pixels differ, by at most 2 of 255 0
1440 by 900 at 1x Dark 9, by at most 2 of 255 0

Two captures of main at 1440 by 900 differ in the same way: 27 pixels, by at most 2 of 255.

Before After
390 by 844 at 3x, light before after
390 by 844 at 3x, dark before after

A wide screen loads the same files. At 1440 by 900 the page makes the same 135 requests before and after, and requests each of the 15 reel photos once, at the same widths. The total changes by 0.3 to 0.4 KB, the size of the new code. In one of four runs of the branch, Google Fonts answered the stylesheet of a template preview frame with a second URL for Figtree (one more request, 20 KB). The reel does not make that request.

Scope

Components: docsite home hero reel

  • This PR has one primary intent.
  • Independently removable deltas were removed or split.
  • Public text and artifacts contain no internal Meta context.

Testing

pnpm -F @astryxdesign/docsite exec vitest run
pnpm -F @astryxdesign/docsite typecheck
pnpm exec eslint --max-warnings 0 <changed files>
pnpm exec prettier --check <changed files>
pnpm build && pnpm -F @astryxdesign/docsite build
pnpm test:docsite-browser
pnpm review:pre --head HEAD
  • src/__tests__/hero-reel-warm-up.test.tsx (new, 18 tests, jsdom). The provider, the swipe area and the dots (the real Pagination) with a five-slide fixture, and a record of the fonts and photos that they ask the browser for. A photo is recorded with the sizes and the srcset that its Image has when it gets its src.
    • Wide: every slide once at the first idle moment; nothing when the reel unmounts first; nothing more when the visitor uses the reel.
    • Narrow: nothing at idle; nothing for a touch that scrolls, a diagonal touch, a touch at 45 degrees, a tap, or 9 px of sideways travel; nothing for focus on a link in the hero text; the two neighbors at 10 px of sideways travel and at keyboard focus on the dots; the next slide over after an arrow key or a swipe; each slide once; the neighbors of the dot that a press moves to, and not those of the slide that it leaves; nothing ahead of need in a data-saving mode or on a 2G connection; every slide when the screen becomes wide; nothing for a reel with no slides.
    • A phone after hydration, where the first render has a wide screen and the next one a narrow screen: nothing loads at idle, and a sideways touch loads the two neighbors.
  • src/__tests__/hero-theme-content.test.ts (new, 6 tests). The real slides: the font list and the photo list are pinned to the 18 font entries and the 15 file names that main has, in the same order, and each slide names its own three photos and the fonts of its own theme.
  • src/__tests__/hero-reel-photos.test.tsx (2 new cases, 10 tests). For each slide, slideAssets names the sources that each of the two card layouts renders for that slide.
  • e2e/home-reel-warm-up.spec.ts (new, 4 tests). The built page, with real touches sent through the DevTools protocol, a tap on a dot, and the Tab key, and a count of the requests for reel photos. Only a browser tells keyboard focus from the focus that a press gives. After a swipe and after a press on a dot, the test waits until the new slide draws its own photos. Each test then checks that the page requested no photo twice, and that it requested the photos of each loaded slide at the widths of the first slide's photos, which the browser selects with no load ahead. The second check is necessary: Chromium shows a wider file that it has in place of a request for the narrower one, so a count of requests does not find a load ahead of a file that is too wide.
  • Mutation check: 50 mutations of the changed lines, and each fails a unit test. They cover the condition on the screen width in both paths, the effect's dependency and its cleanup, each line of warmNeighborsOf with its data-saving rule, goTo, the touch rule and its length, the focus rule of the dots, focus in the hero text, the font and photo lists, and the sizes and the srcset of a photo and their order before its src.
  • The docsite unit suite passes: 1,139 passed, 8 skipped. Type check, ESLint and Prettier are clean. pnpm review:pre --head HEAD reports 0 findings.
  • The docsite browser suite on the build of the head: 99 passed. The new spec also passes (4 of 4) on a copy of the checkout that has only the files of CI's docsite-build artifact, with CI set, which is how CI's docsite-browser job runs it.

Not tested:

  • A real phone and a real network. The touches are sent through the DevTools protocol, and the network times are from DevTools emulation on a local server.
  • Firefox and Safari. The code uses touch events, :focus-visible, requestIdleCallback with the timer fallback that main has, and document.fonts.load.
  • A pen or a mouse on a narrow window. A sideways mouse drag does not load the neighbors; keyboard focus on the dots and a press on a dot do.
  • The deployed site. All numbers are from local production builds.

@vercel

vercel Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 24, 2026 5:32pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 24, 2026
@astracat-bot

astracat-bot Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 24, 2026, 5:46 PM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · ec6f037

Storybook · Sandbox · built from this PR's head

Current run: The current CI run completed, but its trusted analysis is unavailable.


Generated by PR Enrichment workflow | View current CI run

@astracat-bot astracat-bot 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.

Approval waits on an engineering owner's decision about the narrow-screen trade. No current spec decides when the home hero reel loads slide assets, and this change knowingly lets a first swipe on a slow connection show the new slide with the previous slide's photos and a fallback font; the closest record, spec:AST-033 DEC-5 (the current selection owns visible content), leaves open whether a hero slide counts as a selection. An engineering owner records the decision, or names the spec that settles it, by commenting /approve-spec followed by the full head commit SHA, and as an engineering owner you may do so yourself. No blocking code defect was found, and CI has not run on this draft yet.

  • Optional: warmNeighborsOf could return early when prefersReducedData() is true, as the docsite's template prefetch and theme showcase warm-up do, so Save-Data and 2G visitors skip the ahead-of-need slide.
Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claims:
    • Below 1024 px the reel never auto-advances: verified (HeroThemeReel.tsx:358-372).
    • Narrow screens no longer load the other slides at idle: verified (HeroThemeReel.tsx:392-395).
    • The two neighbours load on 10 px of mostly sideways touch travel, on keyboard focus on the dots, and on each slide change: verified (HeroThemeReel.tsx:467-481, :650-657, :345-356).
    • A scrolling, diagonal or 45-degree touch, a tap, and focus on a hero link load nothing: verified (HeroThemeReel.tsx:476; the swipe area's focus handler only pauses).
    • A dot press loads the target's neighbours, and the target itself as it shows: verified (HeroThemeReel.tsx:351-353).
    • Each slide loads once on the narrow path: verified (startedSlides, HeroThemeReel.tsx:317-336).
    • Wide screens, reduced motion included, load every slide once with the same font and photo lists as before: verified (HeroThemeReel.tsx:392-411; heroThemeContent.ts lists against the base's).
    • The hydration render's wide answer is cancelled when the browser's narrow answer replaces it: verified (useMediaQuery server default false; cleanup at HeroThemeReel.tsx:410).
    • The loads start in handlers, the Effect only syncs the cache, and its cleanup runs on rerun and unmount: verified by reading.
    • The new tests number 16 unit, 6 content and 4 browser tests and cover the rules listed: verified by reading; not run.
    • The byte, request and timing measurements, the red-then-green browser run, the mutation check and the passing suites: not reproduced.
    • The docsite's two linked records say nothing about when a page loads a font or photo: verified against main; spec:AST-033 DEC-5 is the closest claim.
    • The first-swipe trade was approved by the docsite owner: no public record; this is the decision approval waits on.
  • Files:
    • apps/docsite/src/app/(site)/_landing/hero/HeroThemeReel.tsx: waits on the owner decision; optional data-saving note.
    • apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.ts: clear.
    • apps/docsite/src/__tests__/hero-reel-warm-up.test.tsx: clear.
    • apps/docsite/src/__tests__/hero-theme-content.test.ts: clear.
    • apps/docsite/e2e/home-reel-warm-up.spec.ts: clear.

Automated review (maintainer link)

@astracat-bot astracat-bot 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.

Approval waits on an engineering owner deciding the narrow-screen loading trade: no current spec decides when the home hero reel loads slide assets, and this change lets a slide whose files have not arrived show the previous slide's photos and a fallback font, on a first swipe over a slow connection and on every newly visited slide for a Save-Data or 2G visitor. The closest record, spec:AST-033 DEC-5 (the current selection owns visible content, with stale content only under an explicit pending treatment), leaves open whether a hero slide counts as a selection. An engineering owner records the decision, or names the spec that settles it, by commenting /approve-spec followed by the full head commit SHA, and as an engineering owner you may do so yourself. The new data-saving check settles the earlier optional note, no code defect was found, and CI has not run on this draft yet.

Claims and files checked

Review mode: incremental; reason: none

  • Claims:
    • Below 1024 px the reel never advances by itself: verified (HeroThemeReel.tsx:360-374).
    • Narrow screens no longer load the other slides at idle: verified (HeroThemeReel.tsx:394-397).
    • The two neighbours load on 10 px of mostly sideways touch travel, on keyboard focus on the dots and on each slide change: verified (HeroThemeReel.tsx:469-483, :652-660, :347-358).
    • A scrolling, diagonal or 45-degree touch, a tap, and focus on a hero link load nothing: verified (HeroThemeReel.tsx:478; the swipe area's focus handler only pauses, :512).
    • A dot press loads its slide's neighbours, and the slide itself as it shows: verified (HeroThemeReel.tsx:354).
    • Each slide loads once on the narrow path: verified (HeroThemeReel.tsx:318-338).
    • A Save-Data or 2G visitor on a narrow screen gets no slide ahead of need: verified (HeroThemeReel.tsx:326, lib/prefersReducedData.ts).
    • Wide screens, reduced motion included, load every slide once with the same font and photo lists as before: verified (HeroThemeReel.tsx:394-413, heroThemeContent.ts:371-446).
    • The hydration render's wide answer is cancelled when the browser's narrow answer replaces it: verified (useMediaQuery server default is false; cleanup at HeroThemeReel.tsx:412).
    • The loads start in handlers, and the one Effect only syncs the cache and cleans up on rerun and unmount: verified by reading.
    • The new tests number 18 unit, 6 content and 4 browser tests and cover the rules listed: verified by reading; not run.
    • The byte, request and timing measurements, the red-then-green browser run, the mutation check and the passing suites: not reproduced.
    • The docsite's linked specs say nothing about when a page loads a font or a photo: verified against the current specs.
    • The docsite owner approved the first-swipe trade privately: no public record; this is the decision approval waits on.
  • Files:
    • apps/docsite/src/app/(site)/_landing/hero/HeroThemeReel.tsx: waits on the owner decision.
    • apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.ts: clear.
    • apps/docsite/src/lib/prefersReducedData.ts: clear.
    • apps/docsite/src/__tests__/hero-reel-warm-up.test.tsx: clear.
    • apps/docsite/src/__tests__/hero-theme-content.test.ts: clear.
    • apps/docsite/e2e/home-reel-warm-up.spec.ts: clear.

Automated review (maintainer link)

…the visitor uses the reel

After load the home page loaded the fonts and photos of every hero reel
slide, so that the reel can advance by itself with no flash. Below
1024 px the reel does not advance by itself, and most visitors never see
another slide: 334 KB that a phone downloads for nothing.

A narrow screen now loads the two slides next to the current one when
the visitor first moves a touch sideways on the reel or moves keyboard
focus to its dots, and again after each change of slide. A wide screen
loads every slide after load, as before.
…or who saves data

On a narrow screen the reel loads the two slides next to the current one
when the visitor starts to use it. One of them is in the direction that
the visitor does not move. In a data-saving mode or on a 2G connection
the reel now loads no slide ahead of need, as the docsite's other
downloads ahead of need do.
@nynexman4464
nynexman4464 force-pushed the nynexman4464/perf/docsite-reel-warm-up-narrow branch from 4f1a21f to ec6f037 Compare November 24, 2026 17:18
@nynexman4464

Copy link
Copy Markdown
Contributor Author

/approve-spec ec6f037

@astracat-bot astracat-bot 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.

Approved pending CI: CI has not run on this draft head yet, so the merge guard still waits for the required checks.

The narrow-screen loading trade, where a slow first swipe shows the previous slide's photos and a fallback font until its files arrive, is decided by an engineering owner's /approve-spec for this head, and the review found no code defect. The earlier optional note about data-saving visitors is addressed by the prefersReducedData() return in warmNeighborsOf.

Claims and files checked

Review mode: full; reason: rebase

  • Claims:
    • Below 1024 px the reel never advances by itself and no longer loads the other slides after load: verified (HeroThemeReel.tsx:365-379, :399-402).
    • The two neighbouring slides load on 10 px of mostly sideways touch travel, on keyboard focus on the dots and on each slide change: verified (HeroThemeReel.tsx:481-485, :659-664, :358-360).
    • A scrolling, diagonal or 45-degree touch, a tap, and focus on a hero link load nothing: verified (HeroThemeReel.tsx:483; the swipe area's focus handler only pauses, :517).
    • A dot press loads its slide as it shows and that slide's two neighbours, not those of the slide it leaves: verified (HeroThemeReel.tsx:358-360 and its unit test).
    • Each slide loads once on the narrow path: verified (HeroThemeReel.tsx:323, :334-343).
    • A Save-Data or 2G visitor on a narrow screen gets no slide ahead of need, as the docsite's other ahead-of-need downloads do: verified (HeroThemeReel.tsx:331; themeShowcaseWarmup.ts and templatePrefetch.ts use the same rule).
    • Until a slide's files arrive it shows the previous slide's photos and a fallback font: verified (the card images keep their element and change source, HeroFloatingCards.tsx:436-532).
    • Wide screens, reduced motion included, load the same fonts and photos in the same order as before: verified (heroThemeContent.ts:398-400, :458-459; hero-theme-content.test.ts).
    • The hydration render's wide answer is cancelled when the browser's narrow answer replaces it: verified (useMediaQuery reads a store whose server answer is false; cleanup at HeroThemeReel.tsx:417).
    • The preload gives each image its card's sizes and srcset before its src, so it fetches the file the card shows: verified (HeroThemeReel.tsx:286-292, heroThemeContent.ts:462-474, the new hero-reel-photos.test.tsx cases).
    • Loads start in handlers, and the one Effect only syncs the cache and cleans up on rerun and unmount: verified by reading.
    • The new tests number 18, 6 and 4, plus 2 new cases in a file of 10, and cover the rules listed: verified by reading; not run.
    • The docsite's linked specs say nothing about when a page loads a font or a photo: verified against the current specs.
    • Byte, request and timing measurements, the red-then-green run, the pixel comparisons, the mutation check and the passing suites: not reproduced.
  • Files:
    • apps/docsite/src/app/(site)/_landing/hero/HeroThemeReel.tsx: clear.
    • apps/docsite/src/app/(site)/_landing/hero/heroThemeContent.ts: clear.
    • apps/docsite/src/lib/prefersReducedData.ts: clear.
    • apps/docsite/src/__tests__/hero-reel-warm-up.test.tsx: clear.
    • apps/docsite/src/__tests__/hero-theme-content.test.ts: clear.
    • apps/docsite/src/__tests__/hero-reel-photos.test.tsx: clear.
    • apps/docsite/e2e/home-reel-warm-up.spec.ts: clear.

Automated review (maintainer link)

@nynexman4464
nynexman4464 marked this pull request as ready for review November 24, 2026 17:55
@nynexman4464
nynexman4464 merged commit 8f3868c into main Nov 24, 2026
146 checks passed
@github-actions
github-actions Bot deleted the nynexman4464/perf/docsite-reel-warm-up-narrow branch November 25, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — ec6f0378 Deployed Nov 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant