Skip to content

perf(docsite): the changelog shows five releases a page, and a package has its own pages - #11503

Merged
nynexman4464 merged 4 commits into
mainfrom
nynexman4464/perf/docsite-changelog-pages
Nov 16, 2026
Merged

nynexman4464 merged 4 commits into
mainfrom
nynexman4464/perf/docsite-changelog-pages

Conversation

@nynexman4464

@nynexman4464 nynexman4464 commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

/changelog loads fast and stays responsive: it sends one page of a package's release notes in place of the package's whole history, and the browser no longer builds the notes twice.

No other template fits: this is a performance change. It has visible parts, which the owner decided (below): the release notes have page navigation, and each package has its own URL.

New public API: none. Only apps/docsite changes.

User or maintainer impact

  • Visitors: the page is ready about as soon as any docs page. Today the browser is busy for 6 s on a fast machine, and for half a minute with a 4× CPU slowdown, after the notes are already on screen.
  • Older releases: the newest five releases of a package are on its first page. Page links below the notes open the older ones, five a page.
  • Maintainers: nothing to maintain. The pages are built from each package's CHANGELOG.md, as before, and a new release moves the older ones down a page.

Measured in headless Chromium at 1440×900. "Before" is the production site. "After" is a local production build of this branch, so compare the sizes, the element count and the main-thread work, not the network times. The deployed preview of this pull request's first commit agrees: its /changelog document is 132 KB on the wire against 1,059 KB in production, with 1.0 s in long tasks against 5.9 s (5.2 s at 4× CPU).

/changelog Before After
HTML document 6.58 MB (1.06 MB compressed) 1.00 MB (0.16 MB compressed)
Elements in the page 31,221 4,524
Page height 431,777 px 55,328 px
Release notes built in the browser twice: the server HTML is replaced 6.6 s after navigation once: the server HTML is hydrated
Main thread in long tasks 6.4 s 1.0 to 1.3 s (two runs)
The same with 4× CPU slowdown 29.1 s, HTML replaced at 30.8 s 5.5 to 6.1 s (two runs)

For scale, a docs page with little content (/docs/getting-started) spends 0.4 to 0.5 s in long tasks on the same build, and 3.0 to 3.9 s at 4× CPU: most of what remains is the docs shell, not the notes.

Other pages on this build: /changelog/cli is 1.59 MB (0.23 MB compressed), and /changelog/core/2 is 1.06 MB (0.18 MB compressed).

Problem and solution fit

  1. Why is the page slow? It carries every release of the selected package: 64 releases and 1.0 MB of markdown for core, which render to 6.6 MB of HTML. Every package's changelog text also travels in the page as data for React: 1.8 MB of that HTML.
  2. Why is it built twice? The view read the selected package from the query string with useSearchParams(). A prerendered page has no query string, so the prerender left that view to the browser and put the default view in as the placeholder. The browser lays out the placeholder, then renders the whole changelog again and replaces it.
  3. Why does that matter? Most visitors want the newest releases. They pay for all 64, twice.

The change gives each page of releases its own static URL, so the server can render exactly what the URL names:

URL Shows
/changelog the default package (core), newest five releases
/changelog/<package> another package, newest five releases
/changelog/<package>/<n> page n (2 and up) of a package's releases
  • The title and the package tabs move to a layout. They stay mounted across packages and pages, so a tab keeps focus and the strip keeps its scroll position.
  • Each tab is a real link to the package's page.
  • The page navigation is the core Pagination component with getPageHref (feat(Pagination): page links through getPageHref #11578), so each page control is a real link: an older page opens in a new tab, can be copied as a link, and opens before the page's scripts arrive. onChange is required and does nothing here, because the link navigates.
  • A page link does not prefetch: the browser loads an older page when the reader asks for it. The package tabs prefetch, as the site's other navigation links do (about 91 KB for the four other packages).
  • The release notes and their page links are the page. The server splits the changelog into releases, applies the existing link passes to the five it sends, and passes only that text to the browser.
  • Old links keep working: /changelog?package=@astryxdesign/<name> redirects to /changelog/<name>, and /changelog/core redirects to /changelog.

Authority

  • Owner decision (nynexman4464, 2026-11-13): paginate the changelog. Do not send the whole history on each load, least of all for much older releases.
  • spec:AST-033 FR8: one canonical URL for each addressable state, and aliases may redirect to it. /changelog stays the canonical URL of the default view; the query form and /changelog/core redirect.
  • spec:AST-033 FR9: URL-encoded tabs and pickers replace the current history entry. The package tabs replaced it before and still do; the page navigation does the same. Back leaves the changelog.
  • spec:AST-033 FR7: a destination is a real link. The package tabs and the page navigation are links; before, a click handler changed the URL.

Change and evidence

File Change
src/lib/changelogPages.ts New. Pure functions: the packages in tab order, a package's releases split into pages of five, each page's URL.
src/lib/changelogData.ts New. The generated changelog text, for server code only.
src/app/(docs)/changelog/layout.tsx New. The title and the package tabs.
src/app/(docs)/changelog/page.tsx, [pkg]/page.tsx, [pkg]/[page]/page.tsx The three URL shapes. Every page is prerendered; an unknown package or page is the not-found page.
src/components/ChangelogView.tsx The frame (title, tabs) and one page of notes with the Pagination component below it, in place of one view that held everything.
src/components/changelogLinkify.ts Exports the release-heading pattern, so the page split and the empty-release note read a release the same way.
src/components/ChangelogRelease.tsx New. Server part: picks the page's releases.
next.config.mjs Redirect for old links that name the package in the query.
src/app/sitemap.ts Lists every changelog page.
src/components/DocsShell.tsx The sidebar keeps What's New selected on every changelog page.

The sitemap lists 35 changelog pages in place of one, and the build prerenders each.

Screenshots (local production build):

Page navigation below the notes, desktop Page navigation below the release notes, desktop
The same on page 2, dark Page navigation on page 2, dark mode
Phone Page navigation on a phone
Top of the page: unchanged Top of the changelog
Another package, /changelog/cli The CLI changelog
Before: the page ends after the oldest release Production: end of the page

Behavior that changes, beyond the page navigation:

  • Version anchors. A link such as /changelog#0-7-9 scrolls to that release only when the release is on that page. No file in this repository links one.
  • Unknown package in an old link. /changelog?package=@astryxdesign/<unknown> now ends on the not-found page. Before, it showed the default package. A theme package in the query still shows the default package.
  • Focus after a page change. The page navigation is part of the page it replaces, so focus returns to the document, and the new page opens at its top.

Checked in the browser on this build:

  • No page error on /changelog at 1440 and 390 px; the first release heading of the server HTML is still in the page after hydration.
  • A package tab keeps focus, adds no history entry, and keeps the scroll position.
  • A page link adds no history entry, and the new page opens at its top. The same with the keyboard: Enter on a page link, then Enter on Next, opens pages 2 and 3, and Back leaves the changelog.
  • A page link pressed before the page's scripts arrive opens the older page as a normal navigation.
  • Scrolling the page links into view starts no request for an older page.

Scope

Components: docsite changelog routes, docsite sitemap, docsite browser tests

  • 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 build && pnpm -F @astryxdesign/docsite build
pnpm test:docsite-browser
pnpm review:pre
  • src/__tests__/changelog-pages.test.ts (new, 15 tests): release splitting, tab order, hidden theme packages, page counts, page URLs, each release shown exactly once across the pages, no page for an unknown package or a page out of range.
  • src/__tests__/changelog-view.test.ts: the selected tab for each URL shape, tabs as replacing links, the empty state, and the page navigation: its landmark name, the page and page count it gets, each page's URL, links that replace the history entry and do not prefetch, and no navigation for a single page. The page range, the current page and the disabled ends are the Pagination component's own, and its tests cover them.
  • src/__tests__/sitemap.test.ts: every changelog page is listed once.
  • e2e/changelog.spec.ts (new, 7 tests): five releases on the page and the server HTML kept through hydration; the page links, with and without the page's scripts, and no history entry; a package tab keeps focus and adds no history entry; old query links; the alias of the default package; not-found URLs.
  • The docsite unit suite passes: 980 passed, 7 skipped. Type check and lint are clean.
  • The whole docsite browser suite passes on the build of this branch: 59 passed; the 17 internal-docs-prompt cases skip without their environment.

Not tested: Safari and Firefox; the change has no browser-specific code.

…e has its own pages

/changelog sent the whole history of the selected package: 6.6 MB of
HTML and 31,000 elements for core. The page read the package from the
query string in the browser, so the prerender left that work to the
browser, which built the whole changelog a second time in place of the
server HTML.

Each package now has static pages of five releases: /changelog for the
default package, /changelog/<package> for the others, and
/changelog/<package>/<n> for older releases. The server sends one page
of release notes, and the browser hydrates it.

The title and the package tabs move to a layout, so they stay mounted,
and a tab keeps focus, across packages and pages. Each tab is a link.
A tab and the page navigation replace the history entry, as the tabs
did before. A link that names the package in the query string, and
/changelog/<default package>, redirect to the page's one URL.
@vercel

vercel Bot commented Nov 13, 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 14, 2026 11:21am UTC

Request Review

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

astracat-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 14, 2026, 11:38 AM UTC

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

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 48ea695

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.

Changes requested: the per-package changelog pages, redirects, sitemap and tests work on this head, but the new page navigation is not a link.

Blocking

  • The page navigation in apps/docsite/src/components/ChangelogView.tsx (lines 147-157) is core Pagination, whose eight buttons navigate only in onChange, so an older page cannot be opened in a new tab, copied as a link or reached before the scripts load, which spec:AST-033 FR7 rules out for a destination; render it as real links built from changelogPagePath(...) with replace, as the package tabs already are, and update the e2e step that clicks the button.

Non-blocking: RELEASE_HEADING in changelogPages.ts accepts ## while the empty-release check in changelogLinkify.ts does not, so one shared pattern would keep the page split and the "No changes in this release" note in step.

Claims and files checked
  • Claim: each changelog page sends five releases instead of the whole history: verified (the built /changelog holds 5 release headings).
  • Claim: the notes are no longer rendered twice: verified (no query-string read remains; the hydration browser test passes).
  • Claim: only the docsite changes and there is no new public API: verified.
  • Claim: /changelog is about 0.95 MB of HTML (0.16 MB compressed), /changelog/cli 1.11 MB and /changelog/core/2 1.42 MB: verified on a local production build.
  • Claim: the production "before" figures and the CPU-throttled timings: not reproduced; a local build of the base serves 6.7 MB with 64 releases.
  • Claim: core has 64 releases and about 1.0 MB of notes: verified.
  • Claim: three URL shapes, every page prerendered, unknown package or page not found: verified.
  • Claim: the title and tabs stay mounted, and a tab keeps focus and adds no history entry: verified (browser test).
  • Claim: each package tab is a real link: verified.
  • Claim: old query links and the default package's own path redirect: verified (307 and 308; the query string is carried to the new address).
  • Claim: the page navigation replaces the history entry and opens the new page at its top: verified.
  • Claim: destinations are real links under the docsite navigation contract: true for the tabs, false for the page navigation (blocking finding).
  • Claim: the build prerenders 521 pages, 42 more than before: verified (479 on the base).
  • Claim: version anchors work only on their own page, and no repository file links one: verified.
  • Claim: focus returns to the document after a page change: verified.
  • Claim: the new and changed unit tests, the six browser tests, the docsite unit suite (975 passed, 7 skipped), type check and lint pass: verified.
  • Claim: the whole docsite browser suite passes (48): not reproduced; only the changelog browser tests were run.
  • File apps/docsite/src/components/ChangelogView.tsx: blocking finding (page navigation).
  • File apps/docsite/src/lib/changelogPages.ts: non-blocking note (release-heading pattern).
  • File apps/docsite/e2e/changelog.spec.ts: clear; its page-navigation step changes with the fix.
  • File apps/docsite/src/__tests__/changelog-view.test.ts: clear; its page-navigation test changes with the fix.
  • Files apps/docsite/next.config.mjs, src/__tests__/changelog-pages.test.ts, src/__tests__/sitemap.test.ts, src/app/(docs)/changelog/page.tsx, [pkg]/page.tsx, [pkg]/[page]/page.tsx, changelogMetadata.ts, layout.tsx, src/app/sitemap.ts, src/components/ChangelogRelease.tsx, src/components/DocsShell.tsx, src/lib/changelogData.ts: clear.

Automated review (maintainer link)

Comment thread apps/docsite/src/lib/changelogPages.ts Resolved
The page navigation was the Pagination component, which has buttons
only: an older page could not open in a new tab, be copied as a link,
or open before the page's scripts arrive.

Each page is now a link to that page's URL, built from Button links and
the Pagination component's page range, with the same look. A page link
replaces the history entry and does not prefetch: the browser loads an
older page when the reader asks for it.

The page split and the empty-release note now share one release-heading
pattern.

@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 head yet because the pull request is a draft, so it runs once the pull request is marked ready for review.

The page navigation is now real links, which resolves the earlier blocking finding, and the per-package pages, redirects, sitemap and tests check out on this head.

Non-blocking: the previous and next chevrons in apps/docsite/src/components/ChangelogView.tsx (lines 198 and 230) do not take rtlStyles.mirror the way core Pagination does; the docsite renders left-to-right only, so this matters only if it gains a right-to-left mode.

Claims and files checked
  • Claim: each changelog page sends five releases of one package instead of its whole history: verified (the built /changelog holds 5 release headings; the base holds 64).
  • Claim: the browser no longer renders the notes a second time: verified (the browser test keeps the server HTML through hydration; no query-string read remains).
  • Claim: only the docsite changes and there is no new public API: verified (all 17 files are under apps/docsite).
  • Claim: /changelog is about 0.95 MB of HTML (0.16 MB compressed), /changelog/cli 1.11 MB and /changelog/core/2 1.42 MB: verified on a local production build.
  • Claim: far fewer elements and much less main-thread work: verified in direction on local builds (31,281 to 4,206 elements; about 3.5 s to 0.3 s of long tasks); the production, preview and CPU-throttled figures and the getting-started comparison were not reproduced.
  • Claim: core has 64 releases and about 1.0 MB of notes: verified.
  • Claim: the old view rendered twice because it read the package from the query string behind a same-view fallback: verified in the base code.
  • Claim: three URL shapes, every page prerendered, an unknown package or page is not found: verified.
  • Claim: the title and tabs stay mounted, and a tab keeps focus and adds no history entry: verified (browser test).
  • Claim: each package tab is a real link: verified.
  • Claim: the page navigation is real links that open in a new tab, copy as links and work before the scripts load: verified (server HTML and the browser test with scripts held).
  • Claim: the page links are built from core Button links and generatePageRange and match Pagination pixel for pixel on desktop and phone: verified (frames identical to the earlier Pagination revision at 1280 px and 390 px).
  • Claim: page links do not prefetch while tabs do: verified in code and the unit test; the 63 KB figure was not measured.
  • Claim: old query links and the default package's own path redirect: verified (307 and 308).
  • Claim: an unknown package in an old query link ends on not-found, while a theme package still shows the default: verified.
  • Claim: a page link replaces the history entry, opens the new page at its top and leaves focus on the document: verified.
  • Claim: version anchors work only on their own page, and no repository file links one: verified.
  • Claim: the build prerenders 521 pages, 42 more than before: verified (479 on the base).
  • Claim: the sidebar keeps What's New selected on every changelog page, and the sitemap lists every changelog page once: verified.
  • Claim: no page error at desktop and phone widths: verified at 1280, 1440 and 390 px.
  • Claim: the new and changed unit tests, the seven browser tests, the docsite unit suite (978 passed, 7 skipped), type check and lint pass: verified.
  • Claim: the whole docsite browser suite passes (49 passed, 17 skipped without their environment): verified.
  • File apps/docsite/src/components/ChangelogView.tsx: non-blocking note (right-to-left chevrons).
  • Files apps/docsite/e2e/changelog.spec.ts, apps/docsite/next.config.mjs, apps/docsite/src/__tests__/changelog-pages.test.ts, apps/docsite/src/__tests__/changelog-view.test.ts, apps/docsite/src/__tests__/sitemap.test.ts: clear.
  • Files apps/docsite/src/app/(docs)/changelog/[pkg]/[page]/page.tsx, apps/docsite/src/app/(docs)/changelog/[pkg]/page.tsx, apps/docsite/src/app/(docs)/changelog/changelogMetadata.ts, apps/docsite/src/app/(docs)/changelog/layout.tsx, apps/docsite/src/app/(docs)/changelog/page.tsx: clear.
  • Files apps/docsite/src/app/sitemap.ts, apps/docsite/src/components/ChangelogRelease.tsx, apps/docsite/src/components/DocsShell.tsx, apps/docsite/src/components/changelogLinkify.ts, apps/docsite/src/lib/changelogData.ts, apps/docsite/src/lib/changelogPages.ts: clear.

Automated review (maintainer link)

…component

Pagination can now render its page controls as links (`getPageHref`).
The changelog used a hand-built row of Button links that copied its look,
because Pagination had buttons only. It now renders Pagination with the
changelog's page URLs and its replacing, non-prefetching link component.

`onChange` is required and does nothing here: the link navigates.

The unit tests keep what the changelog owns: the landmark name, the page
and page count, each page's URL, the link behavior, and no navigation for
a single page. The page range, the current page and the disabled ends are
Pagination's own.

@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 head yet because the pull request is a draft, so it runs once the pull request is marked ready for review.

The page navigation is now core Pagination with page URLs, so every page control is a real link, and the per-package pages, redirects, sitemap and tests check out on this head. This also settles the earlier non-blocking note about the right-to-left chevrons, since Pagination mirrors its own.

Claims and files checked
  • Claim: each changelog page sends five releases of one package instead of the whole history: verified (the built /changelog holds 5 release headings; the base holds 65).
  • Claim: the browser no longer builds the notes twice and hydrates the server HTML: verified (the first server release heading stays in the page after hydration on the head and is replaced on the base; browser test).
  • Claim: only the docsite changes and there is no new public API: verified (all 17 files are under apps/docsite).
  • Claim: /changelog is about 1.00 MB of HTML (0.16 MB compressed): verified (1,000,222 B, 161,319 B gzip on a local production build).
  • Claim: /changelog/cli is 1.59 MB (0.23 MB) and /changelog/core/2 is 1.06 MB (0.18 MB): verified.
  • Claim: far fewer elements, a shorter page and much less main-thread work than production: verified in direction on local builds (31,974 to 4,498 elements, 457,468 to 57,456 px, about 4.7 s to 0.6 s of long tasks); the production, preview and CPU-throttled figures were not reproduced.
  • Claim: a content-light docs page spends less time in long tasks, so most of what remains is the docs shell: verified in direction (about 0.2 s on the getting-started page against 0.6 s on /changelog).
  • Claim: core's changelog is about 1.0 MB of markdown and every package's changelog travelled in the page as data: verified (1.07 MB; the base page passed every package's changelog to the client view); core has 65 releases at this head, one more than the description's 64, after the latest release.
  • Claim: the old view read the package from the query string behind a same-view fallback, so the browser rendered the notes again: verified in the base code.
  • Claim: three URL shapes, every page prerendered, and an unknown package or page is not found: verified (404 for an unknown package, a page-1 alias and a page out of range).
  • Claim: the title and tabs stay mounted in a layout, and a tab keeps focus, keeps the scroll position and adds no history entry: verified (browser test for focus and history; the tab link turns scroll restoration off).
  • Claim: each package tab is a real link: verified.
  • Claim: the page navigation is core Pagination with page URLs, so each control is a real link that opens in a new tab, copies as a link and works before the scripts load, and its change handler does nothing: verified (links in the server HTML; browser test with scripts held back).
  • Claim: page links do not prefetch while package tabs do: verified (no older-page request when the links scroll into view; the tab prefetches were observed); the 91 KB figure was not measured as transfer size.
  • Claim: the server splits the changelog, links only the five releases it sends and sends only that text: verified (no changelog text in any client chunk).
  • Claim: old query links and the default package's own path redirect: verified (307 and 308).
  • Claim: an unknown package in an old link ends on not-found, while a theme package still shows the default: verified.
  • Claim: version anchors work only on their own page, and no repository file links one: verified (no such link in the repository).
  • Claim: a page link adds no history entry, opens the new page at its top and leaves focus on the document, and Back leaves the changelog: verified.
  • Claim: Enter on a page link, then on Next, opens pages 2 and 3: verified from the markup (native links); not driven by keyboard in this review.
  • Claim: the sitemap lists 35 changelog pages and the build prerenders each: verified (35 entries, each prerendered).
  • Claim: the sidebar keeps What's New selected on every changelog page: verified (browser test).
  • Claim: no page error at desktop and phone widths: verified at 1440 px; the 390 px page renders with its page navigation.
  • Claim: the 15 new unit tests, the changed view and sitemap tests, the 7 browser tests, the docsite unit suite (980 passed, 7 skipped), type check and lint pass: verified.
  • Claim: the whole docsite browser suite passes (59 passed, 17 skipped without their environment): verified.
  • Claim: the change has no browser-specific code: verified.
  • Files apps/docsite/e2e/changelog.spec.ts, apps/docsite/src/__tests__/changelog-pages.test.ts, apps/docsite/src/__tests__/changelog-view.test.ts, apps/docsite/src/__tests__/sitemap.test.ts: clear.
  • Files apps/docsite/next.config.mjs, apps/docsite/src/app/sitemap.ts, apps/docsite/src/app/(docs)/changelog/layout.tsx, apps/docsite/src/app/(docs)/changelog/page.tsx, apps/docsite/src/app/(docs)/changelog/changelogMetadata.ts, apps/docsite/src/app/(docs)/changelog/[pkg]/page.tsx, apps/docsite/src/app/(docs)/changelog/[pkg]/[page]/page.tsx: clear.
  • Files apps/docsite/src/components/ChangelogView.tsx, apps/docsite/src/components/ChangelogRelease.tsx, apps/docsite/src/components/DocsShell.tsx, apps/docsite/src/components/changelogLinkify.ts, apps/docsite/src/lib/changelogData.ts, apps/docsite/src/lib/changelogPages.ts: clear.

Automated review (maintainer link)

@nynexman4464
nynexman4464 marked this pull request as ready for review November 16, 2026 22:37
@nynexman4464
nynexman4464 merged commit 24afc75 into main Nov 16, 2026
178 of 184 checks passed
@github-actions
github-actions Bot deleted the nynexman4464/perf/docsite-changelog-pages branch November 17, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — 48ea6956 Deployed Nov 14, 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