Repository navigation
perf(docsite): build the landing previews into the page instead of frames - #11339
Conversation
The homepage templates card rendered seven live page templates one at a time after each tile entered the viewport, so visitors scrolled past blank tiles. The themes card hydrated the whole Butter store. pnpm generate now renders each decorative preview once with react-dom/static, compiled with the docsite's own StyleX Babel plugins and template image loader, and writes src/generated/previewSnapshots.ts. A server component injects each snapshot; CSS scales it and its Theme wrapper inherits the page's color scheme, so dark mode needs no second render and no preview code ships to the browser. Tiles keep each template's desktop layout at every viewport width.
|
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.
Approval waits on an engineering owner deciding whether the docsite homepage ships these build-time frozen previews or keeps the live ones, and two fixes are needed either way.
Blocking:
- With
DOCSITE_ICON_SETset,scripts/generate-preview-snapshots.mjs:78-81passes{iconSet, projectDir}torewriteTemplatePreview, which readsoptions.list, so every docsite build throwsTypeError: Cannot read properties of undefined (reading 'length')instead of rewriting each template preview's icons as AST-084 FR20 requires; passlist: previewIconSetList(previewIconSet), let the rewritten imports resolve from the docsite'snode_moduleslikenext.config.mjsdoes, and add a test with the setting on. previewSnapshotSources.tsx:20-26and:55-61hand-import seven page templates thatTEMPLATE_COMPONENTSinsrc/components/templateComponents.tsalready maps by slug, so build those entries from that registry and keep the slug list in one module thatTemplatesPreviewalso reads.
No current spec governs the homepage previews, so the frozen-or-live choice (phone visitors see the IDE, payment-form and settings tiles in desktop layout, and the homepage HTML grows from about 62 KB to 139 KB compressed) needs an engineering owner to record it by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner. The Vercel preview deployment of this head failed while main deploys succeed, so it is worth checking whether the new generate step causes it. A non-blocking nit: the hideOnWide comment in TemplatesPreview.tsx now sits above the new frame style.
Claims and files checked
- Claim: tiles render once at build time as static HTML with no client JavaScript: verified (
TemplatesPreview.tsxhas no client directive;FrozenPreview.tsxinjects the generated string). - Claim: CSS scales the tiles and dark mode follows the page: verified (
TemplatesPreview.tsx:121-143;FrozenPreview.module.css:6-8with theme values that arelight-dark()pairs). - Claim: phones show each template's desktop layout: verified (the IDE, payment-form and settings templates choose their phone layout with
useMediaQuery, which returns its server default in the prerender). - Claim: image preload hints are removed and images are lazy: verified (
generate-preview-snapshots.mjs:56-60,preview-snapshots.test.ts). - Claim: the generator applies the same image loader and the optional icon-set loader as the Next build: image loader verified; icon-set loader false (it throws).
- Claim: StyleX is compiled with the docsite's own Babel plugins: verified (
generate-preview-snapshots.mjs:40,89-96). - Claim: nothing is committed and
pnpm generateruns before every build and dev start: verified (src/generated/is gitignored;buildanddevscripts). - Claim: the
/templatesgallery keeps its live thumbnails: verified (it still rendersTemplateThumbnail). - Claim: the homepage moves unchanged into
HomePage.tsx: verified (only the signature and two props differ). - Claim: the community page passes the previews the same way: verified (
community/page.tsx:620,628, a server component). - Claim:
esbuildis already a root dev dependency: verified (rootpackage.json). - Claim: the homepage HTML grows to about 139 KB compressed and the other measurements: not checked (no build ran in this review).
- Files:
apps/docsite/package.jsonclear;scripts/generate-preview-snapshots.mjsicon-set finding;src/__tests__/preview-snapshots.test.tsclear (no icon-set case);(site)/HomePage.tsxclear;_landing/FeaturesShowcase.tsxclear;_landing/FrozenPreview.module.cssclear;_landing/FrozenPreview.tsxclear;_landing/TemplatesPreview.tsxcomment nit;_landing/ThemesPreview.tsxclear;_landing/previewSnapshotSources.tsxtemplate-map finding;community/page.tsxclear;(site)/page.tsxclear;pnpm-lock.yamlclear.
The CLI doctor's authoring audit, which /api/search traces, reaches the docsite test files. The new snapshot test imported the generation script, whose public folder path made the tracer add all of public/ to the search function (318 MB, over the 150 MB budget). The tested function moves to scripts/lib/preview-snapshot-html.mjs, which reads no files, and the test imports only that module. The trace is 21.0 MB again.
There was a problem hiding this comment.
Approval waits on an engineering owner deciding whether the docsite homepage ships these build-time frozen previews or keeps the live ones, and the two fixes from the previous review are still needed either way.
Blocking:
- With
DOCSITE_ICON_SETset,scripts/generate-preview-snapshots.mjs:66-69passes{iconSet, projectDir}torewriteTemplatePreview, which readsoptions.list, so the docsite build throwsTypeError: Cannot read properties of undefined (reading 'length')instead of rewriting each template preview's icons as AST-084 FR20 requires; passlist: previewIconSetList(previewIconSet), let the rewritten imports resolve from the docsite'snode_modulesasnext.config.mjsdoes, and add a test with the setting on. previewSnapshotSources.tsx:20-26and:55-61hand-import seven page templates thatTEMPLATE_COMPONENTSinsrc/components/templateComponents.tsalready maps by slug, so build those entries from that registry and keep the slug list in one module thatTemplatesPreviewalso reads.
No current spec governs the homepage previews, so the frozen-or-live choice (phone visitors see the IDE, payment-form and settings tiles in desktop layout, and the homepage HTML grows from about 62 KB to 139 KB compressed) needs an engineering owner to record it by commenting /approve-spec <full head SHA>; the author may do so as an engineering owner. The preview deployment of this revision now succeeds. Non-blocking: the hideOnWide comment in TemplatesPreview.tsx now heads the new frame style, and BlogShowcase.tsx and NavSurfaceMode.tsx still point to page.tsx for code that moved to HomePage.tsx.
Claims and files checked
- Claim: the previews render once at build time and ship as static HTML with no client JavaScript: verified (
TemplatesPreview.tsxhas no client directive;FrozenPreview.tsxinjects the generated string). - Claim: CSS scales the tiles and dark mode follows the page: verified in code (
TemplatesPreview.tsx:134-143;FrozenPreview.module.css:6-8, with theme values that arelight-dark()pairs). - Claim: phones show each template's desktop layout: verified (the IDE, payment-form and settings templates pick their phone layout with
useMediaQuery, which returns its server default in the prerender). - Claim: image preload hints are removed and images are lazy: verified (
scripts/lib/preview-snapshot-html.mjs:20-27and its test). - Claim: the generator applies the same image loader and the optional icon-set loader as the Next build: image loader verified; icon-set loader false (it throws).
- Claim: StyleX is compiled with the docsite's own Babel plugins: verified (
generate-preview-snapshots.mjs:41and:77-84). - Claim: nothing is committed and
pnpm generateruns before every build and dev start, with no new CI step: verified (src/generated/is gitignored; thebuildanddevscripts; no workflow change). - Claim: the
/templatesgallery keeps its live thumbnails: verified (it still rendersTemplateThumbnail). - Claim: the homepage moves unchanged into
HomePage.tsx, and the community page passes the previews the same way: verified (only the signature and two props differ;community/page.tsx:620,628is a server component). - Claim:
esbuildis already a root dev dependency: verified (rootpackage.json). - Claim: the test no longer pulls the generator into the search function's trace: consistent with the code (the new module imports nothing, and the test imports only it); the trace size was not measured, and the preview deployment of this revision succeeds.
- Claim: the homepage HTML grows to about 139 KB compressed, and the timing table: not checked (no build ran in this review).
- Files:
apps/docsite/package.jsonclear;scripts/generate-preview-snapshots.mjsicon-set finding;scripts/lib/preview-snapshot-html.mjsclear;src/__tests__/preview-snapshots.test.tsclear (no icon-set case);(site)/HomePage.tsxclear;_landing/FeaturesShowcase.tsxclear;_landing/FrozenPreview.module.cssclear;_landing/FrozenPreview.tsxclear;_landing/TemplatesPreview.tsxcomment nit;_landing/ThemesPreview.tsxclear;_landing/previewSnapshotSources.tsxtemplate-map finding;community/page.tsxclear;(site)/page.tsxclear;pnpm-lock.yamlclear.
|
/approve-spec 0880e4c |
There was a problem hiding this comment.
Changes requested: the owner's decision settles shipping the homepage and /community previews as build-time snapshots, and two fixes remain in the snapshot generator and its sources.
Blocking:
- With
DOCSITE_ICON_SETset,scripts/generate-preview-snapshots.mjs:66-69passes{iconSet, projectDir}torewriteTemplatePreview, which readsoptions.list, sopnpm generatethrowsTypeError: Cannot read properties of undefined (reading 'length')instead of rewriting each template preview's icons as AST-084 FR20 requires; passlist: previewIconSetList(previewIconSet), let the rewritten imports resolve from the docsite'snode_modulesasnext.config.mjsdoes, and add a test with the setting on. previewSnapshotSources.tsx:20-26and:55-61hand-import seven page templates thatTEMPLATE_COMPONENTSinsrc/components/templateComponents.tsalready maps by slug, so a remapped slug would leave the homepage tile on the old page; build those entries from that registry and keep the slug list in one module thatTemplatesPreviewalso reads.
Non-blocking: the hideOnWide comment in TemplatesPreview.tsx now heads the new frame style, and BlogShowcase.tsx and NavSurfaceMode.tsx still point to page.tsx for code that moved to HomePage.tsx.
Claims and files checked
Claims:
- Today the tiles render one at a time after they enter the viewport: verified (
TemplateThumbnail.tsxIntersectionObserver and render queue). - The previews render once at build time and ship as static HTML with no client JavaScript for them: verified (
TemplatesPreview.tsxandFrozenPreview.tsxare server components;ThemesPreview.tsxtakes the store as a prop). - CSS scales them and follows dark mode: verified in code (
TemplatesPreview.tsx:134-143,FrozenPreview.module.css:6-8). - On phones the IDE, payment-form and settings tiles show their desktop layout: verified (
useMediaQueryin those three templates). - The homepage HTML grows from about 62 KB to 139 KB compressed: author's measurement; shipping the markup in both the HTML and the server-component payload matches the code.
- Template photos are lazy and their preload hints are removed: verified (
scripts/lib/preview-snapshot-html.mjsand its test). - Nothing is committed and every build and dev start renders the previews: verified (
generatescript;src/generated/is gitignored). - No CI step or check is added, and the
/templatesgallery keeps its live thumbnails: verified. - The script applies the same template image loader and the optional icon-set loader as the Next build: image loader verified; icon-set loader false (first blocking finding).
page.tsxpasses the previews to the client homepage, moved toHomePage.tsx: verified, with two new props.esbuildis already a root dev dependency: verified (rootpackage.json).- No current record governs the homepage previews: verified; the owner recorded the decision on this pull request.
- The tested function reads no files, keeping the search function trace at main's size: the module imports nothing (verified); the trace size is the author's measurement.
- Build, test, ESLint and StyleX class checks pass: author's results; the preview deployment of this revision succeeded.
- No public API change and no changeset needed: verified (only the private docsite changes).
Files:
apps/docsite/package.json: clear.apps/docsite/scripts/generate-preview-snapshots.mjs: blocking (icon-set options).apps/docsite/scripts/lib/preview-snapshot-html.mjs: clear.apps/docsite/src/__tests__/preview-snapshots.test.ts: missing the icon-set test (first blocking finding).apps/docsite/src/app/(site)/HomePage.tsx: clear (moved code plus two props).apps/docsite/src/app/(site)/_landing/FeaturesShowcase.tsx: clear.apps/docsite/src/app/(site)/_landing/FrozenPreview.module.css: clear.apps/docsite/src/app/(site)/_landing/FrozenPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/TemplatesPreview.tsx: non-blocking comment placement.apps/docsite/src/app/(site)/_landing/ThemesPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/previewSnapshotSources.tsx: blocking (copied template map).apps/docsite/src/app/(site)/community/page.tsx: clear.apps/docsite/src/app/(site)/page.tsx: clear.pnpm-lock.yaml: clear (one docsite importer entry).
…template registry With DOCSITE_ICON_SET set, the preview snapshot step passed the setting as iconSet, but rewriteTemplatePreview reads a list, so pnpm generate threw a TypeError. The snapshot source rewrites now live in scripts/lib/preview-source-transform.mjs, which passes the list the way the Webpack loader does, and rewritten icon imports resolve from the docsite's node_modules. A test covers the setting on. The snapshot sources now take the templates card's components from TEMPLATE_COMPONENTS, and the card's slugs live in one module that TemplatesPreview also reads. The snapshots are byte-identical. Two file headers now point at HomePage.tsx.
|
/approve-spec b9910fe |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this revision yet; it runs once the pull request is marked ready for review. An engineering owner approved shipping the homepage and /community previews as build-time snapshots, and this revision fixes both earlier findings: the snapshot icon rewrite now gets its set list and resolves the sets from the docsite, and the snapshot sources read the template registry by the slug list the card also uses.
Non-blocking: the unset case in preview-source-transform.test.ts cannot tell whether the icon rewrite ran; a rewriteIcons spy that expects no call would cover the unset row of AST-084 FR20 for the snapshot path.
Claims and files checked
Claims:
- Today the template tiles render one at a time after they enter the viewport: verified (
TemplateThumbnail.tsxIntersectionObserver and render queue on main). - Each decorative preview renders once during the docsite build and ships as static HTML, with no client JavaScript for the previews: verified (
TemplatesPreview.tsxandFrozenPreview.tsxare server components;ThemesPreview.tsxtakes the store as a prop). - CSS scales the previews and they follow dark mode: verified in code (
TemplatesPreview.tsx:124-133,FrozenPreview.module.css:6-8). - On phones the IDE, payment-form and settings tiles show their desktop layout, as the themes card already does: verified (
useMediaQueryin those three templates; the forced desktop context moved fromThemesPreview.tsx). - The homepage HTML grows from about 62 KB to 139 KB compressed because the markup ships twice: the size is the author's measurement; shipping in both the HTML and the server-component payload matches the code.
- Only the lazy template photos load after first paint, and no preview code downloads when the cards scroll into view: verified (
scripts/lib/preview-snapshot-html.mjs; no client module imports the previews). - Nothing is committed, and every build and dev start renders the previews: verified (
generatescript;src/generated/is gitignored); duringnext deva template edit shows only after the next generate. - No CI step or check is added, and the
/templatesgallery keeps its live thumbnails: verified. - The generator applies the Next build's template image loader and, with the icon-set setting, the icon rewrite with its set list, with rewritten imports resolving from the docsite: verified (
preview-source-transform.mjs:36-53,generate-preview-snapshots.mjs:98-100, and a run of the transform on this revision). - With a set that is not installed, generation fails with the loader's own message: verified (the transform throws the loader's error, which fails the bundle step).
- The snapshot sources take the seven pages from the template registry by the slug list the card also reads, and only the script reads them: verified (
previewSnapshotSources.tsx:41-65,templatePreviewRows.ts). page.tsxpasses the previews to the client homepage moved toHomePage.tsx, and the community page does the same: verified; the move adds only two pass-through props.esbuildis already a root dev dependency: verified (rootpackage.json).- No current record governs the homepage previews: verified; an engineering owner recorded the decision for this revision.
- The tested markup function reads no files, keeping the search function trace at main's size: the module imports nothing (verified); the trace size is the author's measurement, and the preview deployment of this revision, whose build runs the size check, succeeded.
- The build, the new tests, ESLint, the StyleX class check, byte-identical snapshots and a 3 s generation: the author's results; the preview deployment of this revision succeeded.
- No public API change and no changeset needed: verified (only the private docsite changes).
Files:
apps/docsite/package.json: clear.apps/docsite/scripts/generate-preview-snapshots.mjs: clear.apps/docsite/scripts/lib/preview-snapshot-html.mjs: clear.apps/docsite/scripts/lib/preview-source-transform.mjs: clear.apps/docsite/src/__tests__/preview-snapshots.test.ts: clear.apps/docsite/src/__tests__/preview-source-transform.test.ts: non-blocking: the unset case does not assert that the icon rewrite stays off.apps/docsite/src/app/(site)/HomePage.tsx: clear (moved code plus two props).apps/docsite/src/app/(site)/_landing/BlogShowcase.tsx: clear.apps/docsite/src/app/(site)/_landing/FeaturesShowcase.tsx: clear.apps/docsite/src/app/(site)/_landing/FrozenPreview.module.css: clear.apps/docsite/src/app/(site)/_landing/FrozenPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/TemplatesPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/ThemesPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/previewSnapshotSources.tsx: clear.apps/docsite/src/app/(site)/_landing/templatePreviewRows.ts: clear.apps/docsite/src/app/(site)/community/NavSurfaceMode.tsx: clear.apps/docsite/src/app/(site)/community/page.tsx: clear.apps/docsite/src/app/(site)/page.tsx: clear.pnpm-lock.yaml: clear (one docsite importer entry).
The frozen template tiles now have the same wrapper elements as the live tiles they replace: the frame is inert, FrozenPreview renders as the scaler itself instead of adding a wrapper, and each snapshot keeps the preview-viewport wrapper between its Theme wrapper and the template. FrozenPreview.module.css gives that wrapper the height rules of the live preview surface. Two differences stay because the scale comes from CSS instead of script: the frame is a size container, and the scale matches the script's within 0.0005.
|
/approve-spec 7b84d2e |
There was a problem hiding this comment.
Changes requested: an engineering owner approved shipping the homepage and /community previews as build-time snapshots for this revision, and two fixes remain before it can land.
- The snapshot's viewport rules in
FrozenPreview.module.css(lines 14-23) copy the.viewportrules ofTemplatePreviewSurface.module.css(lines 32-41) that the template dialog and gallery share, so give that stylesheet a second selector for the snapshot'spreview-viewportwrapper under a classFrozenPreviewapplies, import it fromFrozenPreview, and delete the copy. - Regression: the branch conflicts with main in
ThemesPreview.tsx, where #11331 moved the themes card's Butter photos to 320 px WebP copies, and because the'themes-store'snapshot source inpreviewSnapshotSources.tsxstill renders the 704 px PNGs, resolve it by moving thatimagesoverride into the snapshot source instead of dropping it.
CI has not run on this revision because of the conflict. Main has also gained #11291, which speeds up the live gallery thumbnails, so the live column of the description's table predates it. Non-blocking: the unset case in preview-source-transform.test.ts still cannot tell whether the icon rewrite ran; a rewriteIcons spy that expects no call would cover it.
Claims and files checked
Claims:
- An engineering owner decided to ship the frozen previews: verified (an exact-revision approval comment on this pull request).
- Today the template tiles render one at a time after they enter the viewport: verified at the base (
TemplateThumbnail.tsxvisibility observer and one-at-a-time render queue). - Each decorative preview renders once during the docsite build and ships as static HTML, with no client JavaScript for the previews: verified (
TemplatesPreview.tsxandFrozenPreview.tsxare server components,ThemesPreview.tsxtakes the store as a prop, and only server pages import them). - CSS scales the previews and they follow dark mode: verified in code (
TemplatesPreview.tsx:109-133,FrozenPreview.module.css:6-8); the per-frame dark-mode checks are the author's. - On phones the IDE, payment-form and settings tiles show their desktop layout, as the themes card already does: verified (
useMediaQueryin those three templates; the forced desktop context moved fromThemesPreview.tsx). - The homepage HTML grows from about 62 KB to 139 KB compressed because the markup ships twice: the size is the author's measurement; shipping in both the HTML and the server-component payload matches the code.
- Only the lazy template photos load after first paint, and no preview code downloads when the cards scroll into view: verified (
scripts/lib/preview-snapshot-html.mjs; no client module imports the previews). - Nothing is committed, and every build and dev start renders the previews: verified (
generate,devandbuildscripts;src/generated/is gitignored). - No CI step or check is added, and the
/templatesgallery keeps its live thumbnails: verified. - The generator compiles StyleX with the docsite's Babel plugins and applies the Next build's template image loader and, with the icon-set setting, the icon rewrite with its set list and imports resolved from the docsite: verified (
generate-preview-snapshots.mjs:43-107,preview-source-transform.mjs:36-53). - The snapshot sources take the seven pages from the template registry by the slug list the card also reads, and only the script reads them: verified (
previewSnapshotSources.tsx:41-61,templatePreviewRows.ts). - Each tile keeps the live tile's wrappers and scales with the container-width pattern the themes card uses: verified in code; the pixel and computed-style comparisons are the author's.
page.tsxpasses the previews to the client homepage moved toHomePage.tsx, and the community page does the same: verified; the move adds only two pass-through props.esbuildis already a root dev dependency: verified (rootpackage.json).- No current record governs the homepage previews: verified; the docsite data contract's registry rule applies to the slug source and is met.
- The tested markup function reads no files, and the search function trace is back to main's size: the module imports nothing (verified), and the preview deployment of this revision, whose build runs the function size check, succeeded.
- The new tests' results, ESLint, the StyleX class check, byte-identical snapshots after the registry move, the dark-mode checks and a 3 s generation: the author's results.
- No public API change and no changeset needed: verified (only the private docsite changes).
Files:
apps/docsite/package.json: clear.apps/docsite/scripts/generate-preview-snapshots.mjs: clear.apps/docsite/scripts/lib/preview-snapshot-html.mjs: clear.apps/docsite/scripts/lib/preview-source-transform.mjs: clear.apps/docsite/src/__tests__/preview-snapshots.test.ts: clear.apps/docsite/src/__tests__/preview-source-transform.test.ts: non-blocking: the unset case does not assert that the icon rewrite stays off.apps/docsite/src/app/(site)/HomePage.tsx: clear (moved code plus two props).apps/docsite/src/app/(site)/_landing/BlogShowcase.tsx: clear.apps/docsite/src/app/(site)/_landing/FeaturesShowcase.tsx: clear.apps/docsite/src/app/(site)/_landing/FrozenPreview.module.css: blocking: copies the shared viewport rules.apps/docsite/src/app/(site)/_landing/FrozenPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/TemplatesPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/ThemesPreview.tsx: blocking: conflicts with main.apps/docsite/src/app/(site)/_landing/previewSnapshotSources.tsx: the'themes-store'entry needs main's WebP photos when the conflict is resolved.apps/docsite/src/app/(site)/_landing/templatePreviewRows.ts: clear.apps/docsite/src/app/(site)/community/NavSurfaceMode.tsx: clear.apps/docsite/src/app/(site)/community/page.tsx: clear.apps/docsite/src/app/(site)/page.tsx: clear.pnpm-lock.yaml: clear (one docsite importer entry).
…emplate-previews # Conflicts: # apps/docsite/src/app/(site)/_landing/ThemesPreview.tsx
…view surface FrozenPreview.module.css repeated the .viewport height rules of TemplatePreviewSurface.module.css. That stylesheet now also matches the snapshot's preview-viewport wrapper under a snapshotHost class, which FrozenPreview applies, and the copy is gone.
|
/approve-spec 1ec02c2 |
There was a problem hiding this comment.
Changes requested: the owner approved shipping the homepage and /community previews as build-time snapshots, and this revision fixes every earlier blocking finding, but main has since landed its own build-time renderer for the templates card and this branch no longer merges.
- Regression: #11292 on main renders the templates card at build time with
generate-landing-template-previews.mjsand lazy iframes, and this branch conflicts with it inapps/docsite/package.json,FeaturesShowcase.tsxandTemplatesPreview.tsx; rebase and keep one build-time renderer and one slug list for the card, either by extending #11292's generator to the themes store or by replacing it here and deleting its generator,landingTemplateRows.json,templatePreviewColorMode.ts, its test and its.gitignoreentries.
Two non-blocking notes: the generator's StyleX dev option follows the shell's NODE_ENV rather than the production build's (generate-preview-snapshots.mjs:37, babel.config.js:11), and the unset-icon-set test case cannot tell whether the icon rewrite ran (preview-source-transform.test.ts:25).
Claims and files checked
Claims:
- At the base, template tiles render one at a time once visible, with blank boxes until then: verified (
TemplateThumbnail.tsxvisibility observer, render queue, Skeleton); the download can start in idle time while a tile is within one viewport, so "downloads after entering the viewport" is partly outdated. - The build renders each decorative preview once and ships static HTML with no preview JavaScript: verified (
generate-preview-snapshots.mjs;TemplatesPreviewandFrozenPrevieware server components). - CSS scales the previews and they follow dark mode: verified (
TemplatesPreview.tsxscaler;FrozenPreview.module.csssetscolor-scheme: inheriton the theme wrapper, which has no box). - Phones show the desktop layout of some templates: verified (the IDE, payment-form and settings templates read
useMediaQuery, which returns its server default at build time). - The homepage HTML grows from about 62 KB to 139 KB compressed: not verified here; the snapshot markup does ship in both the HTML and the server-component payload.
- Only the lazy template photos load after first paint: verified (
finishSnapshotHtmland its test). - Nothing is committed and every build and dev start regenerates the snapshots: verified (
generate,buildanddevscripts;src/generated/is ignored). - No CI step or check is added: verified.
- The
/templatesgallery keeps its live thumbnails and does not use these components: verified. - The generator compiles StyleX with the docsite's own Babel plugins so class names match the page: partly; same plugins, but the
devoption follows the shell'sNODE_ENV(note above). - The image rewrite and the optional icon-set rewrite match the Next build, with imports resolved from the docsite: verified (
preview-source-transform.mjs, esbuildnodePaths). - The seven templates come from the template registry by a slug list
TemplatesPreviewalso reads, in the Neutral theme, plus the Butter store, and the sources are read only by the script: verified. FrozenPreviewinjects one snapshot and dark mode needs no second render: verified.- Each tile keeps the live tile's wrappers and scales the 1100 px snapshot from CSS with a size container on the frame: verified; the 0.0005 scale match is the author's measurement.
- The homepage moved unchanged into
HomePage.tsxbehind a thin server page, and the community page passes the previews the same way: verified (only the two pass-through props differ). ThemesPreviewtakes the store as a prop and its swatch rail is unchanged: verified.esbuildis declared from the existing root dev dependency: verified (catalog entry; the rootpackage.jsonalready lists it).- No current record governs the homepage previews, and the moved homepage's Effects are unchanged: verified.
- The function-size fix: the new test imports only a module that reads no files: verified; the traced sizes are not verified here.
- Tests pass (one red before its fix), snapshots are byte-identical after the registry move, ESLint is clean, every snapshot class exists in the style sheet, and the dark-mode, wrapper and pixel checks on the preview hold: not verified here.
- No changeset and no new public API because no published package changes: verified.
Files:
apps/docsite/package.json: conflicts with main'sgeneratestep (blocking).apps/docsite/scripts/generate-preview-snapshots.mjs: non-blocking StyleX mode note.apps/docsite/scripts/lib/preview-snapshot-html.mjs: clear.apps/docsite/scripts/lib/preview-source-transform.mjs: clear.apps/docsite/src/__tests__/preview-snapshots.test.ts: clear.apps/docsite/src/__tests__/preview-source-transform.test.ts: non-blocking test note.apps/docsite/src/app/(site)/HomePage.tsx: clear.apps/docsite/src/app/(site)/_landing/BlogShowcase.tsx: clear.apps/docsite/src/app/(site)/_landing/FeaturesShowcase.tsx: conflicts with main (blocking).apps/docsite/src/app/(site)/_landing/FrozenPreview.module.css: clear.apps/docsite/src/app/(site)/_landing/FrozenPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/TemplatesPreview.tsx: conflicts with main's iframe renderer (blocking).apps/docsite/src/app/(site)/_landing/ThemesPreview.tsx: clear.apps/docsite/src/app/(site)/_landing/previewSnapshotSources.tsx: clear.apps/docsite/src/app/(site)/_landing/templatePreviewRows.ts: duplicates main's slug list after the rebase (part of the blocking finding).apps/docsite/src/app/(site)/community/NavSurfaceMode.tsx: clear.apps/docsite/src/app/(site)/community/page.tsx: clear.apps/docsite/src/app/(site)/page.tsx: clear.apps/docsite/src/components/TemplatePreviewSurface.module.css: clear.pnpm-lock.yaml: clear.
…f frames Main now renders the landing templates card previews at build time with the CLI's page renderer and shows each one in a lazy-loaded frame (#11292). This merge keeps that generate step and renderer and puts each preview's rendered markup into the page instead: same document, no frame, no script. The markup uses the site's own StyleX classes, so the page's stylesheet styles it, and the page's color mode reaches it through CSS variables. - generate-landing-template-previews.mjs writes the markup to src/generated/landingPreviews.ts instead of public HTML files, keeps the live preview's preview-viewport wrapper, and also renders the themes card's Butter store, so one step renders every landing preview. - The preview images load at low priority instead of lazily, so they are in place when the visitor reaches the card, as they were in frames. - The tiles keep the wrappers of the live tiles they replace. - The frame color-mode helper is no longer needed. Co-authored-by: nynexman4464 <[email protected]>
|
/approve-spec 79179d0 |
There was a problem hiding this comment.
Changes requested. The engineering owner's approval settles shipping the homepage and /community previews as build-time snapshots, and every earlier review finding is fixed; two things still need work at this revision:
- The themes-card store is rendered without the icon-set rewrite that
spec:AST-084FR20 requires for each template preview source, so a docs-site build withDOCSITE_ICON_SETset shows the template's own icons in the store (generate-landing-template-previews.mjs:202-210); stage the store's template the waystagePreviewPagestages a tile and add a set and unset test for it. - The description describes an earlier revision against a baseline older than main (#11292 already renders the tiles at build time in lazy frames), names files that no longer exist, and says the photos are lazy while this revision loads them eagerly at low priority; please rewrite it for this revision, re-measure against main, and either make the photos lazy or state the eager download.
A non-blocking note on the dropped scale fallback is inline. CI's heavy jobs have not run on this revision yet.
Claims and files checked
- Claim: previews render once at build time and ship as static markup with no preview script. Verified:
TemplatesPreviewandFrozenPrevieware server components. - Claim: today the tiles render one at a time after entering the viewport. False against main, which shows build-time pages in lazy frames.
- Claim: the visible difference is that phones see the desktop layout. False against main, whose 1100 px frames already show it.
- Claim: homepage HTML grows from about 62 KB to 139 KB. Not reproduced; measured against the page before #11292.
- Claim: image preload hints are removed. Verified (
preview-snapshot-html.mjs:24). - Claim: the photos are lazy. False: they get low fetch priority (
preview-snapshot-html.mjs:25-27). - Claim: nothing is committed and every build and dev start regenerates the previews. Verified (
generatescript, ignoredsrc/generated/). - Claim: no CI step is added. Verified.
- Claim: the templates gallery keeps its live thumbnails. Verified: nothing else imports these components.
- Claim: a new esbuild generator, source-transform module, sources module, slug-list module and Babel compile, with
package.jsonand lockfile changes. False: none exist at this revision. - Claim:
FrozenPreviewinjects one snapshot whose theme wrapper inherits the page color scheme. Verified (FrozenPreview.module.css:5-7). - Claim:
TemplatesPreviewscales with the same CSS pattern asThemesPreview. Verified (TemplatesPreview.tsx:140,ThemesPreview.tsx:132). - Claim: the client homepage moved unchanged to
HomePage.tsx, and/communitypasses the previews as props. Verified. - Claim: new tests cover the snapshot markup and wiring. Verified for
preview-snapshots.test.ts; the source-transform test does not exist. - Claim: no published package or public API changes. Verified.
- Claim: timings, byte-identical snapshots, dark-mode, wrapper and function-size checks. Not reproduced; they come from earlier revisions with a different renderer.
- Files:
generate-landing-template-previews.mjsandThemesStorePreview.tsx(store skips the icon-set rewrite);lib/preview-snapshot-html.mjs(eager photos, unlike the description);TemplatesPreview.tsx(non-blocking: scale fallback dropped);.gitignore(non-blocking: stale frame pages no longer ignored). - Files clear:
check-workspace-build.mjs,landing-template-previews.test.ts,preview-snapshots.test.ts,HomePage.tsx,BlogShowcase.tsx,FeaturesShowcase.tsx,FrozenPreview.module.css,FrozenPreview.tsx,ThemesPreview.tsx,templatePreviewColorMode.ts(deleted),community/NavSurfaceMode.tsx,community/page.tsx,(site)/page.tsx,TemplatePreviewSurface.module.css.
The generate step rendered the themes card's Butter store from the store template itself, so with DOCSITE_ICON_SET set the store kept the template's own icons, unlike every other template preview. The step now stages a copy of the store template with the same image and icon rewrites as each tile, and ThemesStorePreview receives the staged store component. Tests cover the setting set and unset.
|
/approve-spec 5ea31d5 |
There was a problem hiding this comment.
Approved pending CI: the build, test and docs-site test jobs have not run on this revision yet. The engineering owner's approval for this revision settles shipping the homepage and /community previews as build-time snapshots, and both earlier blockers are fixed: the themes-card store now gets the icon-set rewrite, and the description matches this revision.
Two non-blocking notes:
TemplatesPreview.tsx:140drops main'stan(atan2())andscale(0.25)fallback, so a browser without typedcalc()division shows each tile's page unscaled (details inline)..gitignoreno longer ignorespublic/landing/template-previews/, and the generate step no longer deletes that folder, so a checkout that built main keeps seven stale, unignored frame pages (details inline).
Claims and files checked
- Claim: Previews render at build time and ship as static markup with no preview script. Verified:
TemplatesPreviewandFrozenPrevieware server components (TemplatesPreview.tsx:153-195,FrozenPreview.tsx:18-52). - Claim: The baseline is main with build-time pages in lazy frames. Verified: main's
TemplatesPreview.tsxrenders a lazy, sandboxed frame per tile. - Claim: On main the themes-card store renders in the browser. Verified: main's
ThemesPreview.tsxis a client component that renders the store template. - Claim: No new public API. Verified: only the private docs site changes.
- Claim: Phones see each template's desktop layout. Verified from code: the tile templates use no viewport media queries, and their script-driven layout renders at desktop width at build time.
- Claim: Homepage HTML grows from about 63 KB to 138 KB compressed, and total bytes drop. Not reproduced: the author's local measurement.
- Claim: Every tile's markup is in the first paint, and photos are in place when the cards arrive. Markup verified (server-rendered); photo timing not reproduced.
- Claim: No preview code or frame documents download or run when the cards appear. Verified.
- Claim: The previews follow live system-scheme changes and the site's toggle. Verified from code (
FrozenPreview.module.css:6-8); not run. - Claim: Nothing is committed, and every build and dev start regenerates the previews. Verified: the docs site's
buildanddevscripts rungenerate, andsrc/generated/is ignored. - Claim: No CI step or check is added. Verified.
- Claim: The templates gallery keeps its live thumbnails. Verified.
- Claim: Each tile keeps the live preview's viewport wrapper. Verified (
generate-landing-template-previews.mjs:75). - Claim: The store is staged with the same image and icon rewrites as every tile. Verified (
generate-landing-template-previews.mjs:189-195). - Claim: The page styles are not kept, and the markup uses the site's own classes. Verified (
generate-landing-template-previews.mjs:114-117). - Claim: Image preload hints are removed and photos load eagerly at low priority. Verified (
preview-snapshot-html.mjs:24-28). - Claim: Main's lazy frames also download every tile photo when the card arrives, with the same bytes. Not reproduced.
- Claim: The snapshot's theme wrapper inherits the page's color scheme. Verified (
FrozenPreview.module.css:6-8). - Claim: The viewport rules are shared with the live preview surface. Verified (
TemplatePreviewSurface.module.css:35-49). - Claim:
TemplatesPreviewis a server component again, keeps the live tile's wrappers and scales with the themes card's CSS pattern. Verified (TemplatesPreview.tsx:132-141,:181-186;ThemesPreview.tsx:132); the scale accuracy figure is not reproduced. - Claim: The store keeps its desktop layout and the 320 px WebP photos, and receives the staged store component. Verified (
ThemesStorePreview.tsx:26-61). - Claim: The route is a thin server entry, the client homepage moved unchanged, and the community page passes the previews the same way. Verified: the move differs only in the new props.
- Claim: The workspace preflight requires Butter's built module. Verified (
check-workspace-build.mjs:50). - Claim: The frame color-mode helper is removed. Verified.
- Claim: No current record governs the homepage previews. Verified against the current records.
- Claim: Timings, layout deltas and dark-mode luminance checks. Not reproduced: the author's local measurements.
- Claim: The docs-site build passes. Corroborated by the successful preview deployment of this revision; CI's build job has not run.
- Claim: The tests pass, and new tests cover the store staging with the icon setting set and unset. The tests are present (
landing-template-previews.test.ts:86-147); they were not run here, and CI's test jobs have not run. - Claim: ESLint is clean. Verified by CI's lint job.
- Claim: The lockfile and the docs-site dependencies match main. Verified: neither file changes.
- Claim: No changeset is needed because no published package changes. Verified.
- Files with notes:
TemplatesPreview.tsx(non-blocking: scale fallback dropped);.gitignore(non-blocking: stale frame pages no longer ignored). - Files clear:
check-workspace-build.mjs,generate-landing-template-previews.mjs,lib/preview-snapshot-html.mjs,landing-template-previews.test.ts,preview-snapshots.test.ts,HomePage.tsx,BlogShowcase.tsx,FeaturesShowcase.tsx,FrozenPreview.module.css,FrozenPreview.tsx,ThemesPreview.tsx,ThemesStorePreview.tsx,templatePreviewColorMode.ts(deleted),community/NavSurfaceMode.tsx,community/page.tsx,(site)/page.tsx,TemplatePreviewSurface.module.css.
…ngth division The tile scale divided two lengths in calc(), which Firefox before 158 does not support, so it dropped the declaration and showed each tile's page unscaled. The scale uses tan(atan2(100cqw, 1100px)) again, with a fixed scale(0.25) for a browser without it, as main did. The docsite also ignores the frame pages that earlier builds wrote under public/landing/template-previews.
|
/approve-spec a537f63 |
|
Decision: D-20261112-413 |
There was a problem hiding this comment.
Approved pending CI: the build, test and docs-site test jobs have not run on this revision yet; they run before merge.
The engineering owner's approval for this revision settles shipping the homepage and /community previews as build-time markup in the page. Both earlier notes are fixed: the tiles use main's tan(atan2()) scale with its scale(0.25) fallback again, and .gitignore keeps ignoring the frame pages that earlier builds wrote. No further changes are needed.
Claims and files checked
- Claim: the two cards' previews ship as markup in the page with no preview script. Verified:
TemplatesPreviewandFrozenPrevieware server components (TemplatesPreview.tsx:157-199,FrozenPreview.tsx:33-50); timing not reproduced. - Claim: the baseline is main with build-time pages in lazy frames. Verified: main's
TemplatesPreview.tsxrenders a lazy, sandboxed frame per tile. - Claim: this change keeps that build step and places its markup in the page, with no frames and no script. Verified.
- Claim: on main the themes-card store renders in the browser. Verified: main's
ThemesPreview.tsxis a client component that renders the store template. - Claim: no new public API. Verified: only the private docs site changes.
- Claim: the build-time generation comes from the earlier templates-card pull request. Verified from the file's history on main.
- Claim: phones see each tile's desktop layout. Verified from code: the tiles' responsive branches run in script at build time, and their one container query sits on the template's own grid.
- Claim: the homepage HTML grows from about 63 KB to 138 KB compressed locally, and total bytes drop once frame documents count. Not reproduced: the author's measurement.
- Claim: every tile's markup is in the first paint, and photos are in place when the cards scroll into view. Markup verified; photo timing not reproduced.
- Claim: no preview code or frame documents download or run when the cards appear. Verified.
- Claim: live dark-mode changes restyle the previews with the page. Verified from code (
FrozenPreview.module.css:6-8); not run. - Claim: nothing is committed, and every build and dev start renders the previews. Verified: the docs site's
buildanddevscripts rungenerate, andsrc/generated/is ignored. - Claim: no CI step or check is added. Verified.
- Claim: the templates gallery keeps its live thumbnails. Verified.
- Claim: frames are separate documents that cannot share the page's styles or color mode. Verified: main passes the color mode in each frame's URL.
- Claim: the store hydrated a whole template for a decorative miniature. Verified.
- Claim: the generate step writes each preview's body markup to an ignored module, keeps the live preview's viewport wrapper, and drops the page styles. Verified (
generate-landing-template-previews.mjs:66-80,:114-117,:247-258). - Claim: the store is staged with the same image and icon rewrites as every tile. Verified (
generate-landing-template-previews.mjs:137-167,:189-195). - Claim: image preload hints are removed, and photos load eagerly at low priority. Verified (
preview-snapshot-html.mjs:22-29). - Claim: main's lazy frames also download every tile photo on arrival, with the same bytes. Not reproduced.
- Claim: the snapshot's theme wrapper inherits the page's color scheme. Verified (
FrozenPreview.module.css:6-8). - Claim: the viewport rules are shared with the live preview surface. Verified (
TemplatePreviewSurface.module.css:35-49). - Claim:
TemplatesPreviewkeeps the live tile's wrappers and scales withtan(atan2())and ascale(0.25)fallback, as main does. Verified (TemplatesPreview.tsx:117-145,:185-190); the accuracy figure is not reproduced. - Claim: the store keeps its desktop layout and the 320 px WebP photos, and
ThemesPreviewtakes the rendered store as a prop. Verified (ThemesStorePreview.tsx:26-61,ThemesPreview.tsx:167-180). - Claim: the route is a thin server component, the client homepage moved unchanged, and the community page passes the previews the same way. Verified: the move differs only in two props.
- Claim: the workspace preflight requires Butter's built module. Verified (
check-workspace-build.mjs:50). - Claim: the frame color-mode helper is removed. Verified.
- Claim: no current record governs the homepage previews. Verified against the current records.
- Claim: local and deployed timing, blank-frame, paint, byte and HTML-size tables. Not reproduced: the author's measurements.
- Claim: visual parity, tile box and dark-mode luminance checks. Not reproduced: the author's measurements.
- Claim: without length division in
calc(), the old scale left tiles unscaled and the new one scales them. Not reproduced; the code matches main's fallback. - Claim:
.gitignorekeeps ignoring the old frame pages. Verified (.gitignore:18-19). - Claim: the docs-site build passes. Corroborated by the successful preview deployment of this revision; CI's build job has not run.
- Claim: the tests pass, and new tests cover the store staging with the icon setting set and unset. The tests are present and match the code (
landing-template-previews.test.ts:86-147); not run here, and CI's test jobs have not run. - Claim: ESLint is clean. Verified by CI's lint job.
- Claim: the lockfile and the docs-site dependencies match main. Verified: neither file changes.
- Claim: no changeset is needed because no published package changes. Verified.
- Files clear:
.gitignore,check-workspace-build.mjs,generate-landing-template-previews.mjs,lib/preview-snapshot-html.mjs,landing-template-previews.test.ts,preview-snapshots.test.ts,HomePage.tsx,BlogShowcase.tsx,FeaturesShowcase.tsx,FrozenPreview.module.css,FrozenPreview.tsx,TemplatesPreview.tsx,ThemesPreview.tsx,ThemesStorePreview.tsx,templatePreviewColorMode.ts(deleted),community/NavSurfaceMode.tsx,community/page.tsx,(site)/page.tsx,TemplatePreviewSurface.module.css.
Owner decision: ship (Cindy, 2026-11-12): "instead of iframing them could we server render them".
Primary intent
Homepage visitors see the "Ready to ship templates" and "Themes that fit your brand" cards complete when they scroll to them, with no client JavaScript for these decorative previews.
Baseline: main with #11292, which renders each templates-card preview at build time and shows it in a lazy-loaded frame. This PR keeps that build step and puts the rendered markup into the page itself instead: same document, no frames, no script. The same step now also renders the themes card's Butter store, which on main still hydrates the whole store template in the browser.
No other template fits: this is a performance change. One visible difference was decided by the owner (below).
New public API: none.
Credit: the build-time generation (
scripts/generate-landing-template-previews.mjs, the CLI page renderer, the image and icon rewrites, the tile rows) comes from #11292 by @nynexman4464. This PR reuses it and changes what it emits.Owner decision (answered: ship)
User or maintainer impact
pnpm generate(which everynext buildandnext devruns first) renders the previews, so a changed template shows up in the next build. No CI step or check is added. The/templatesgallery keeps its live thumbnails.Problem and solution fit
scripts/generate-landing-template-previews.mjs(from #11292)src/generated/landingPreviews.ts(build output, not committed) instead of HTML files for frames. Each tile keeps the live preview'spreview-viewportwrapper. It also renders the themes card store: it stages a copy of the store template with the same image and icon rewrites as every tile (soDOCSITE_ICON_SETapplies to it too), andThemesStorePreviewshows it inside the Butter theme. The page styles are not kept: the markup uses the site's own StyleX classes.scripts/lib/preview-snapshot-html.mjs(new)_landing/FrozenPreview.tsx+.module.css(new)components/TemplatePreviewSurface.module.css.viewportrules also match the previews'preview-viewportwrapper (snapshotHost), so there is one copy of those rules._landing/TemplatesPreview.tsxscale(tan(atan2(100cqw, 1100px)))and a fixedscale(0.25)fallback, as main does:calc()cannot divide two lengths in every browser yet (Firefox before 158). container-type on the frame, scale from CSS, within 0.0005 of the script's._landing/ThemesStorePreview.tsx(new),_landing/ThemesPreview.tsx(site)/page.tsx,(site)/HomePage.tsx,FeaturesShowcase.tsx,community/page.tsxpage.tsxis a thin server component that passes the previews to the existing client homepage (moved unchanged toHomePage.tsx). The community page passes them the same way.scripts/check-workspace-build.mjsAuthority
No current record governs the homepage previews.
pnpm specs:for --diff origin/mainroutes global claims only; the react-component-runtime effects route comes from the existinguseEffectcalls in the movedHomePage.tsx, unchanged.Change and evidence
Same harness throughout: headless Chromium from Playwright (the agent sandbox blocks a full Chrome launch), cold cache, 4x CPU slowdown, phone 390 px with Fast 4G, desktop 1440 px, medians of 3. Local production builds (
next start) of main and of this PR:The host's load was higher during the main runs (56–94) than during this PR's runs (9–37), so the time rows favour this PR somewhat; the blank share, bytes and layout rows do not depend on load.
Deployed, on the same CDN: this PR's preview of
5ea31d58against production (eec79323, #11292 frames). Same harness, one warm-up load each first so the image optimizer is warm for both, then medians of 3:Each blank-share figure is the screenshot sampled every 100 ms: 3.9% is 2 frames out of about 51, 2.0% is 1. So on the CDN the tiles finish one sample (100 ms) later than with frames. The frames were complete before the scroll ended in most runs because the browser had already loaded them; the in-page tiles paint in the frame after the scroll.
Visual parity with the build the owner approved (
0880e4c0): side-by-side stills of both cards at desktop 1440 and phone 390, light and dark, differ in 0.03–0.06% of pixels (tolerance 24 per channel). Layout, crop, scale and colours match. Tile boxes and wrappers are identical to79179d0c's preview (0 px, 0% pixels).Scope
Components: docsite homepage templates card and themes card, community page cards
Testing
pnpm -F @astryxdesign/docsite buildpasses, including the template gallery bundle check and the server-function size check (/api/search21.1 MB, the same as main).vitest runon the landing preview, snapshot markup, template image and icon loader, thumbnail and preview coverage tests pass. New tests cover the store staging withDOCSITE_ICON_SETset (the icon rewrite runs on the store template) and unset (no rewrite); they failed before the store staging was added.calc(): checked in Chromium with that feature turned off (--disable-blink-features=CSSTypedArithmetic; a full Firefox does not launch in the agent sandbox). Withcalc(100cqw / 1100px)every tile's page stayed unscaled at 1100 px; withtan(atan2())each page scales to its tile (scale 0.1927 desktop, 0.1677 phone), as on main. In normal Chromium the stills are pixel-identical before and after this change (0.00% at tolerance 0).apps/docsite/.gitignorekeeps ignoringpublic/landing/template-previews/, the frame pages that earlier builds wrote, so a checkout that built main does not show them as new files.package.jsondependencies match main.No changeset: no published package changes.