Skip to content

[10% Time] Improve Core Web Vitals for home, article, and live pages - #14476

Draft
amoore108 wants to merge 25 commits into
latestfrom
amoore108-improve-core-web-vitals
Draft

amoore108 wants to merge 25 commits into
latestfrom
amoore108-improve-core-web-vitals

Conversation

@amoore108

@amoore108 amoore108 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Defer the live page header player until the reader opens it. LiveHeaderMedia still renders BumpLoader upfront, so RequireJS loads with the page as it does today. It only mounts MediaLoader, and with it BUMP, SMP and player initialisation, on the first click of "Watch Live". On that first open, playback starts from the existing eventMapping prop once the playlist has loaded, and the existing warning-level rules still apply. MediaLoader itself is unchanged.
  • Only prioritise the first homepage curation's billboard image. It's the only billboard that gets fetchpriority="high" and a preload.
  • Lazy-load non-lead article images. On article and media article pages, the lead image is the first image block, rather than any image in blocks 1–4. It's only loaded eagerly, preloaded and given high priority when it's within the first four blocks. Every other image is lazy-loaded.
  • Stop webpack bundling Moment's implicit dynamic locale context. Services import the locales they need explicitly.

Performance

Lighthouse 13, mobile (default simulated throttling), performance category only. Each version was a local production build (yarn build in ws-nextjs-app) serving fixture data. Base is latest at this branch's merge-base. I ran 5 rounds, alternating between the versions in each round, and these are the medians.

Page Metric Base This PR Change
Live page with header media (/mundo/live/c7dkx155e626t) TBT 178 ms 69 ms -109 ms (-61%)
JS transferred 908 KB 539 KB -369 KB (-41%)
Requests 64 56 -8
Performance score 90 93 +3
Article (/pidgin/articles/cwl08rd38l6o) FCP / LCP / TBT 1822 / 4075 / 107 ms 1754 / 4074 / 107 ms No change
Homepage (/pidgin) LCP / TBT 6323 / 107 ms 6233 / 103 ms Within noise
Live page without header media (/pidgin/live/c7p765ynk9qt) TBT 223 ms 241 ms Within noise (204–277 ms across all runs)

CLS was 0 everywhere.

Notes:

  • The main win is on live pages with header media. The player's scripts and initialisation now only happen when a reader asks for the stream.
  • The image priority changes don't make a measurable difference on the pages tested here, because their lead images are already early in the page. They stop images further down the page competing with above-the-fold content when a page has several images in its first blocks.
  • The Moment change made no measurable difference to the JS transferred on the pages tested.
  • Homepage LCP is dominated by the transfer time of the remote iChef image, so it varies with the network.
  • These are local test results from fixture pages, not test/live data.

Validation

  • Production build passes: cd ws-nextjs-app && yarn build.
  • Unit tests pass for the changed areas, including LiveHeaderMedia, MediaLoader, PortraitVideoCarousel, ImageWithCaption, Curation, ArticlePage, MediaArticlePage and the live Post suites. The full Next.js unit suite passes too.
  • New and updated tests cover:
    • the header player only mounting after a click;
    • RequireJS being loaded before the first click;
    • playing exactly once after the player loads on first open;
    • only the first image being prioritised when other blocks come before it;
    • a lead image past block 4 being lazy-loaded and not preloaded.
  • ESLint passes for all changed files.

amoore108 and others added 5 commits October 9, 2026 10:10
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@amoore108 amoore108 changed the title Improve Core Web Vitals on media pages Improve Core Web Vitals for home, article, and live pages Oct 9, 2026
@amoore108 amoore108 self-assigned this Oct 9, 2026
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@amoore108 amoore108 changed the title Improve Core Web Vitals for home, article, and live pages [10% time] Improve Core Web Vitals for home, article, and live pages Oct 12, 2026
@amoore108 amoore108 changed the title [10% time] Improve Core Web Vitals for home, article, and live pages [10% Time] Improve Core Web Vitals for home, article, and live pages Oct 12, 2026

This comment was marked as outdated.

amoore108 and others added 3 commits October 22, 2026 13:46
Coordinate cold, concurrent and cached RequireJS loading before requesting BUMP. Cancel stale initialization and cover header playback and failure paths with regression tests.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move BumpLoader and shared dependency readiness coordination into a colocated module while preserving existing imports and player behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This comment was marked as outdated.

amoore108 and others added 4 commits October 22, 2026 14:11
Cover HIGH and MAXIMUM billboards at positions zero and one so preloading and high fetch priority remain limited to the first curation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exercise the page renderer with five non-image blocks before the lead image and a distinct later image. Verify eager lead loading, lazy subsequent loading and toggle-controlled preload and fetch priority.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This comment was marked as outdated.

amoore108 and others added 2 commits October 22, 2026 14:45
Register the Russian Moment locale explicitly while retaining the implicit-locale bundle optimization. Cover both Ukrainian variants in isolated module registries so other services and Moment fallback loading cannot hide a missing locale.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This reverts commit 08ecad0. The Ukrainian ru-UA variant is no longer used, so the added locale import and tests are unnecessary. Keep the Moment bundle optimization and all earlier review fixes unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

This comment was marked as outdated.

amoore108 and others added 5 commits October 23, 2026 10:40
Notify LiveHeaderMedia after BUMP reports playlistLoaded and pass the ready player directly to the callback. This prevents play() from being called immediately after load(), before the live playlist can start.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the RequireJS readiness coordinator with a simpler approach.
LiveHeaderMedia now renders BumpLoader upfront, so RequireJS is loaded
with the page as before, and only the player itself is mounted when the
reader first opens the media. Playback on that first open is triggered
from the existing eventMapping prop once the playlist has loaded.

This restores MediaLoader, its types and the PortraitVideoCarousel and
live Post tests to how they were before the coordinator was added.
A lead image further down an article than block 4 is unlikely to be in
the initial viewport, so lazy-load it and skip the preload and high
fetch priority rather than competing with above-the-fold content.
LiveHeaderMedia now renders BumpLoader alongside MediaLoader, so the
module mocks used by the live page tests need to provide it too.

This comment was marked as outdated.

Cover the first-open path where the player loads after the click: it
should not play for Level 1 warnings and above, or if the reader has
closed the media before the player has loaded.
…ore-web-vitals

# Conflicts:
#	src/app/components/LiveHeaderMedia/index.tsx

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants