Repository navigation
perf(docsite): the changelog shows five releases a page, and a package has its own pages - #11503
Conversation
…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.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
There was a problem hiding this comment.
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 corePagination, whose eight buttons navigate only inonChange, so an older page cannot be opened in a new tab, copied as a link or reached before the scripts load, whichspec:AST-033FR7 rules out for a destination; render it as real links built fromchangelogPagePath(...)withreplace, 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
/changelogholds 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:
/changelogis about 0.95 MB of HTML (0.16 MB compressed),/changelog/cli1.11 MB and/changelog/core/21.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.
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.
There was a problem hiding this comment.
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
/changelogholds 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:
/changelogis about 0.95 MB of HTML (0.16 MB compressed),/changelog/cli1.11 MB and/changelog/core/21.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
Buttonlinks andgeneratePageRangeand matchPaginationpixel for pixel on desktop and phone: verified (frames identical to the earlierPaginationrevision 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.
…site-changelog-pages
…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.
There was a problem hiding this comment.
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
/changelogholds 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:
/changelogis 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/cliis 1.59 MB (0.23 MB) and/changelog/core/2is 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
Paginationwith 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.
Primary intent
/changelogloads 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/docsitechanges.User or maintainer impact
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
/changelogdocument 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)./changelogFor 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/cliis 1.59 MB (0.23 MB compressed), and/changelog/core/2is 1.06 MB (0.18 MB compressed).Problem and solution fit
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.The change gives each page of releases its own static URL, so the server can render exactly what the URL names:
/changelog/changelog/<package>/changelog/<package>/<n>n(2 and up) of a package's releasesPaginationcomponent withgetPageHref(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.onChangeis required and does nothing here, because the link navigates./changelog?package=@astryxdesign/<name>redirects to/changelog/<name>, and/changelog/coreredirects to/changelog.Authority
spec:AST-033FR8: one canonical URL for each addressable state, and aliases may redirect to it./changelogstays the canonical URL of the default view; the query form and/changelog/coreredirect.spec:AST-033FR9: 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-033FR7: 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
src/lib/changelogPages.tssrc/lib/changelogData.tssrc/app/(docs)/changelog/layout.tsxsrc/app/(docs)/changelog/page.tsx,[pkg]/page.tsx,[pkg]/[page]/page.tsxsrc/components/ChangelogView.tsxPaginationcomponent below it, in place of one view that held everything.src/components/changelogLinkify.tssrc/components/ChangelogRelease.tsxnext.config.mjssrc/app/sitemap.tssrc/components/DocsShell.tsxThe sitemap lists 35 changelog pages in place of one, and the build prerenders each.
Screenshots (local production build):
/changelog/cliBehavior that changes, beyond the page navigation:
/changelog#0-7-9scrolls to that release only when the release is on that page. No file in this repository links one./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.Checked in the browser on this build:
/changelogat 1440 and 390 px; the first release heading of the server HTML is still in the page after hydration.Scope
Components: docsite changelog routes, docsite sitemap, docsite browser tests
Testing
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 thePaginationcomponent'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.internal-docs-promptcases skip without their environment.Not tested: Safari and Firefox; the change has no browser-specific code.