Repository navigation
perf(docsite): count the home page's components on the server - #13012
Draft
nynexman4464 wants to merge 1 commit into
Draft
nynexman4464 wants to merge 1 commit into
nynexman4464 wants to merge 1 commit into
Conversation
Two client components of the home page imported the component registry to show "Over 190 components". The registry holds the documentation of every component, so the page loaded a 1.7 MB script to count its entries. The page's server entry now counts the public Core components and gives the page the number. A browser test fails when the home page loads a script that holds the registry.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
November 19, 2026 21:22
Contributor
PR Analysis Report
Generated by PR Enrichment workflow | View current CI run |
Contributor
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. Moving the component count into the home page's server entry keeps the same registry-derived number and copy, and the new unit and browser tests pin both. Next step: mark the pull request ready for review so CI runs the docsite build and the new browser test.
Claims and files checked
Review mode: full; reason: no-earlier-review
- Claim: the home page takes its count from its server entry and its client scripts no longer import the component registry. Verified:
page.tsximports and counts it (lines 13, 20-25); neither section imports it; no client module of the home page imports it as a value. - Claim: only the docsite app changes, with no public API change. Verified: all six files are under
apps/docsite. - Claim: a cold home-page visit downloads about 403 KB less and parses about 1,700 KB less script, in 138 requests instead of 140. Not reproduced (local build measurements); consistent with the removed client imports.
- Claim: other pages are unchanged, and the playground grows 8 KB from chunk regrouping. Not reproduced; no code of those pages changes.
- Claim: the base loaded the registry because both client sections imported it to count. Verified in the base sources.
- Claim: the registry is about 1.7 MB minified. Not reproduced; the generated source is about 2.4 MB.
- Claim: the count uses the same expression and is 190. Verified: the expression is unchanged, and the head's registry has 191 public Core components.
- Claim: the package and blog registries still ship on the home page. Verified (hero content and blog showcase imports).
- Claim: the docsite product-data decision still holds and no linked claim decides which module counts. Verified against the current docsite contract.
- Claim: the spec routing tool routes no concern claim to the change. Consistent: the global-baseline router returns no concern match.
- Claim: no visible change. Verified for the copy by the code and the unit test; screenshot and text-hash comparisons not reproduced.
- Claim: the browser test fails on main and passes on this branch. Not reproduced; the failing line numbers match the head spec.
- Claim: the browser test detects the registry with ten description samples and checks them on
/componentsfirst. Verified by reading (218 eligible descriptions, 10 distinct samples). - Claim: the server page passes a number to the client
HomePage. Verified. - Claim: the unit test has 3 tests and its fixture separates a wrong filter, package or rounding. Verified: it passes 3 of 3, and each listed mutation changes the fixture's answer.
- Claim: 16 mutations were checked. Not reproduced.
- Claim: the docsite unit suite, type check, ESLint, Prettier and the pre-review check are clean. ESLint and Prettier clean on the six files; type check shows no new error against the base with packages unbuilt; the full suite and pre-review check not run.
- Claim: the browser suite passed 79 of 83, the 4 failures unrelated. Not reproduced; CI has not run.
- Claim: late scripts, Firefox, Safari and the deployed site are untested. Accepted as stated; the test reads scripts loaded before network idle.
- File
apps/docsite/src/app/(site)/page.tsx: clear. - File
apps/docsite/src/app/(site)/HomePage.tsx: clear. - File
apps/docsite/src/app/(site)/_landing/FeaturesShowcase.tsx: clear. - File
apps/docsite/src/app/(site)/_landing/DiscoverShowcase.tsx: clear. - File
apps/docsite/src/__tests__/home-component-count.test.tsx: clear. - File
apps/docsite/e2e/home-component-registry.spec.ts: clear (runs in CI).
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.
Primary intent
The docs home page gets the number of components from its server entry. Its scripts no longer hold the component registry, which the page loaded only to count entries.
No other template fits: this is a performance change with no visible change, no new capability, and no public API. Only
apps/docsitechanges.User or maintainer impact
/components, a component page and the playground render from the registry in the browser, and still load it.generated/componentRegistry. A browser test fails when one does.Bytes for a cold first visit, on local production builds (
next build, thennext start) ofmainat 49473f0 and of this branch. Headless Chromium 149, bytes on the wire from the DevTools protocol, two runs of each page with the same result.///components/components/Button/playground"Script text" is the size after decompression: what the browser parses. The home page makes 138 requests in place of 140.
The playground loads 8 KB more. With the registry out of the home page, webpack groups a few shared modules into other chunks, and the set that the playground loads comes out 18 KB larger before compression. No code of the playground changes.
On the deployed site on 2026-11-19 the registry script was 320 KB of the home page's 3,342 KB on the wire, and 1,414 KB of text.
Problem and solution fit
FeaturesShowcaseandDiscoverShowcaseare client components. Each importedcomponentsfromgenerated/componentRegistryand counted the public Core components when the module loaded, for the copy "Over 190 components" and "Browse 190+ components".Each delta maps to that problem:
src/app/(site)/page.tsxHomePagethe number ascoreComponentCount.src/app/(site)/HomePage.tsxsrc/app/(site)/_landing/FeaturesShowcase.tsxfeaturesmap types that one entry without a title.src/app/(site)/_landing/DiscoverShowcase.tsxsrc/__tests__/home-component-count.test.tsxe2e/home-component-registry.spec.tsThe count is the same expression as before: the Core components that are not hidden and are not hooks, rounded down to the nearest 10. It is 190 on both builds.
No tagalongs, and no public API change: nothing under
packages/is touched.Not in this change: the home page's scripts also hold the generated package registry and blog registry.
Authority
spec:AST-033DEC-1 (product data has one registry-backed owner): the number still comes from the generated registry, and no page owns a count of its own. The count moves from two client modules to the page's server entry.spec:AST-033andarchitecture:knowledge-contractsare linked toapps/docsite/**. None of their claims covers which module counts the components, or what a page's scripts hold.pnpm specs:for --diff origin/mainroutes no concern claim to the added lines.Change and evidence
Red, then green. The new browser test on a production build of
main:On the build of this branch both tests pass.
How the test finds the registry. It takes ten component descriptions, spread over the generated registry, in a form that a minifier does not change. A script that holds more than half of them holds the registry. The test first loads
/componentsand expects to find such a script there, so a registry that the samples cannot find fails the test and does not pass it.No visible change.
mainand on this branch: the components card says "Over 190 components" and the closing section says "Browse 190+ components"./is the same on both builds (5,242 characters, the same hash).mainmade the same way: 12 are identical pixel for pixel. 1 differs where the hero reel shows another slide at the moment of the capture, and two captures ofmaindiffer there in the same way.The server and client boundary, in a real build.
page.tsxis a server component and givesHomePage, a client component, a number.pnpm -F @astryxdesign/docsite buildpasses, and the page hydrates with no error (the existinghome-late-scriptbrowser tests pass).Scope
Components: docsite home page
Testing
src/__tests__/home-component-count.test.tsx(new, 3 tests). The server entry's count, against a registry fixture in which a wrong filter, a wrong package or a wrong rounding gives a number in another ten. The copy of the components card and of the closing section, for a number that they receive.e2e/home-component-registry.spec.ts(new, 2 tests). The first is described above. The second proves that the built page shows the count on the components card and in the closing section: the unit test cannot see whatHomePagegives the two sections.HomePagegives the components card another number;HomePagegives the closing section another number; a client component of the home page imports the registry again.pnpm review:pre --head HEADreports 0 findings.internal-docs-prompt.spec.ts: theafterEachwait for network idle timed out. The cause is not in this change: on the same machine that spec alone fails 3 of its 17 tests the same way on the build ofmain, and 2 of 17 on the build of this branch. The machine has no direct route to external hosts. That this is the cause was not confirmed.Not tested: