Skip to content

perf(docsite): build the landing previews into the page instead of frames - #11339

Merged
cixzhang merged 10 commits into
mainfrom
perf/docsite-frozen-template-previews
Nov 12, 2026
Merged

cixzhang merged 10 commits into
mainfrom
perf/docsite-frozen-template-previews

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Visitors: every tile has its markup on first paint, and the photos are in place when the cards scroll into view. No preview code or frame documents download or run when the cards appear. Live dark-mode changes (system scheme or the site's toggle) restyle the previews with the page.
  • Maintainers: nothing is committed. pnpm generate (which every next build and next dev runs first) renders the previews, so a changed template shows up in the next build. No CI step or check is added. The /templates gallery keeps its live thumbnails.

Problem and solution fit

  1. Why render in the page instead of frames? Each frame is a separate document: the browser loads 7 more documents, and the frame tiles do not share the page's styles or color mode, so the color mode has to travel in the frame URL.
  2. Why does that matter? The previews are decoration. The owner asked for server-rendered markup in the page rather than frames.
  3. Why the themes card too? It hydrated the whole store template for a decorative miniature.
File Change
scripts/generate-landing-template-previews.mjs (from #11292) Writes each preview's rendered body markup to src/generated/landingPreviews.ts (build output, not committed) instead of HTML files for frames. Each tile keeps the live preview's preview-viewport wrapper. 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 (so DOCSITE_ICON_SET applies to it too), and ThemesStorePreview shows 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) Removes React's image preload hints and makes the preview photos load eagerly at low fetch priority, not lazily. A lazy image starts only near the viewport, so visitors saw the photos arrive; #11292's lazy frames start loading much farther away, and they too download every tile photo on arrival (1.83 MB on both).
_landing/FrozenPreview.tsx + .module.css (new) Server component that injects one preview. The preview's Theme wrapper inherits the page's color scheme.
components/TemplatePreviewSurface.module.css Its .viewport rules also match the previews' preview-viewport wrapper (snapshotHost), so there is one copy of those rules.
_landing/TemplatesPreview.tsx Server component again. Each tile keeps the live tile's wrappers (inert frame > scaler > Theme > preview viewport > template). It scales the 1100 px preview with scale(tan(atan2(100cqw, 1100px))) and a fixed scale(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 The store's content and desktop layout as the generate step renders it, with #11331's 320 px WebP photos; it receives the staged store component. ThemesPreview takes the rendered store as a prop.
(site)/page.tsx, (site)/HomePage.tsx, FeaturesShowcase.tsx, community/page.tsx page.tsx is a thin server component that passes the previews to the existing client homepage (moved unchanged to HomePage.tsx). The community page passes them the same way.
scripts/check-workspace-build.mjs The preflight also requires Butter's built module, which the store render reads.
removed #11292's helper that passed the color mode to each frame in its URL; in-page previews take the page's mode from CSS.

Authority

No current record governs the homepage previews. pnpm specs:for --diff origin/main routes global claims only; the react-component-runtime effects route comes from the existing useEffect calls in the moved HomePage.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:

After a jump to the templates card Main (#11292 frames) This PR
Frames with a blank or incomplete tile, first 5 s (phone / desktop) 5.9% / 17.6% 3.9% / 7.8%
Tiles complete-looking (phone / desktop) 0.3 s / 0.9 s 0.2 s / 0.4 s
Main thread in the 5 s after the scroll (phone / desktop) 0.39 s / 5.6 s 0.18 s / 1.1 s
JS downloaded after the scroll (phone / desktop) 31 KB / 1,013 KB 31 KB / 0
LCP (phone / desktop) 7.9 s / 0.91 s 5.7 s / 0.41 s
Image bytes on arrival 1.83 MB 1.83 MB
Page HTML (compressed) 63 KB, plus 7 frame documents 138 KB, no frames

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 5ea31d58 against production (eec79323, #11292 frames). Same harness, one warm-up load each first so the image optimizer is warm for both, then medians of 3:

After a jump to the templates card Production (#11292 frames) This PR
Frames with a blank or incomplete tile, first 5 s (phone / desktop) 2.0% / 2.0% 3.9% / 3.9%
Tiles complete-looking (phone / desktop) 0.1 s / 0.1 s 0.2 s / 0.2 s
Main thread in the 5 s after the scroll (phone / desktop) 0.30 s / 0.42 s 0.25 s / 0.49 s
JS downloaded after the scroll (phone / desktop) 31 KB / 0 31 KB / 0
First paint (phone / desktop) 2.14 s / 1.06 s 1.32 s / 0.72 s
LCP (phone / desktop) 2.14 s / 1.06 s 2.37 s / 0.90 s
Image bytes on arrival 1.83 MB 1.83 MB
Page HTML (brotli) + frame documents 52 KB + 133 KB (7 frames) 103 KB, no frames

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 to 79179d0c's preview (0 px, 0% pixels).

  • Layout: tile boxes match production with 0 px delta on all 7 tiles, desktop and phone. The tile wrappers match the live tiles that perf(docsite): render the landing templates card previews at build time #11292 replaced, except the frame's container-type.
  • Dark mode: the previews render in the matching scheme at load in light and in dark, and follow a live system-scheme change and the site's toggle. Tile and card luminance in the same screenshot disagreed in 0 samples per switch.

Scope

Components: docsite homepage templates card and themes card, community page cards

  • 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 build passes, including the template gallery bundle check and the server-function size check (/api/search 21.1 MB, the same as main).
  • vitest run on the landing preview, snapshot markup, template image and icon loader, thumbnail and preview coverage tests pass. New tests cover the store staging with DOCSITE_ICON_SET set (the icon rewrite runs on the store template) and unset (no rewrite); they failed before the store staging was added.
  • Browsers without length division in calc(): checked in Chromium with that feature turned off (--disable-blink-features=CSSTypedArithmetic; a full Firefox does not launch in the agent sandbox). With calc(100cqw / 1100px) every tile's page stayed unscaled at 1100 px; with tan(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/.gitignore keeps ignoring public/landing/template-previews/, the frame pages that earlier builds wrote, so a checkout that built main does not show them as new files.
  • ESLint on the changed files: clean. The lockfile and the docsite package.json dependencies match main.

No changeset: no published package changes.

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.
@vercel

vercel Bot commented Nov 12, 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 12, 2026 2:10pm UTC

Request Review

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

astracat-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 12, 2026, 2:24 PM UTC

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

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · a537f63

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.

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_SET set, scripts/generate-preview-snapshots.mjs:78-81 passes {iconSet, projectDir} to rewriteTemplatePreview, which reads options.list, so every docsite build throws TypeError: Cannot read properties of undefined (reading 'length') instead of rewriting each template preview's icons as AST-084 FR20 requires; pass list: previewIconSetList(previewIconSet), let the rewritten imports resolve from the docsite's node_modules like next.config.mjs does, and add a test with the setting on.
  • previewSnapshotSources.tsx:20-26 and :55-61 hand-import seven page templates that TEMPLATE_COMPONENTS in src/components/templateComponents.ts already maps by slug, so build those entries from that registry and keep the slug list in one module that TemplatesPreview also 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.tsx has no client directive; FrozenPreview.tsx injects the generated string).
  • Claim: CSS scales the tiles and dark mode follows the page: verified (TemplatesPreview.tsx:121-143; FrozenPreview.module.css:6-8 with theme values that are light-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 generate runs before every build and dev start: verified (src/generated/ is gitignored; build and dev scripts).
  • Claim: the /templates gallery keeps its live thumbnails: verified (it still renders TemplateThumbnail).
  • 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: esbuild is already a root dev dependency: verified (root package.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.json clear; scripts/generate-preview-snapshots.mjs icon-set finding; src/__tests__/preview-snapshots.test.ts clear (no icon-set case); (site)/HomePage.tsx clear; _landing/FeaturesShowcase.tsx clear; _landing/FrozenPreview.module.css clear; _landing/FrozenPreview.tsx clear; _landing/TemplatesPreview.tsx comment nit; _landing/ThemesPreview.tsx clear; _landing/previewSnapshotSources.tsx template-map finding; community/page.tsx clear; (site)/page.tsx clear; pnpm-lock.yaml clear.

Automated review (maintainer link)

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.

@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.

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_SET set, scripts/generate-preview-snapshots.mjs:66-69 passes {iconSet, projectDir} to rewriteTemplatePreview, which reads options.list, so the docsite build throws TypeError: Cannot read properties of undefined (reading 'length') instead of rewriting each template preview's icons as AST-084 FR20 requires; pass list: previewIconSetList(previewIconSet), let the rewritten imports resolve from the docsite's node_modules as next.config.mjs does, and add a test with the setting on.
  • previewSnapshotSources.tsx:20-26 and :55-61 hand-import seven page templates that TEMPLATE_COMPONENTS in src/components/templateComponents.ts already maps by slug, so build those entries from that registry and keep the slug list in one module that TemplatesPreview also 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.tsx has no client directive; FrozenPreview.tsx injects 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 are light-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-27 and 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:41 and :77-84).
  • Claim: nothing is committed and pnpm generate runs before every build and dev start, with no new CI step: verified (src/generated/ is gitignored; the build and dev scripts; no workflow change).
  • Claim: the /templates gallery keeps its live thumbnails: verified (it still renders TemplateThumbnail).
  • 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,628 is a server component).
  • Claim: esbuild is already a root dev dependency: verified (root package.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.json clear; scripts/generate-preview-snapshots.mjs icon-set finding; scripts/lib/preview-snapshot-html.mjs clear; src/__tests__/preview-snapshots.test.ts clear (no icon-set case); (site)/HomePage.tsx clear; _landing/FeaturesShowcase.tsx clear; _landing/FrozenPreview.module.css clear; _landing/FrozenPreview.tsx clear; _landing/TemplatesPreview.tsx comment nit; _landing/ThemesPreview.tsx clear; _landing/previewSnapshotSources.tsx template-map finding; community/page.tsx clear; (site)/page.tsx clear; pnpm-lock.yaml clear.

Automated review (maintainer link)

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 0880e4c

@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 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_SET set, scripts/generate-preview-snapshots.mjs:66-69 passes {iconSet, projectDir} to rewriteTemplatePreview, which reads options.list, so pnpm generate throws TypeError: Cannot read properties of undefined (reading 'length') instead of rewriting each template preview's icons as AST-084 FR20 requires; pass list: previewIconSetList(previewIconSet), let the rewritten imports resolve from the docsite's node_modules as next.config.mjs does, and add a test with the setting on.
  • previewSnapshotSources.tsx:20-26 and :55-61 hand-import seven page templates that TEMPLATE_COMPONENTS in src/components/templateComponents.ts already 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 that TemplatesPreview also 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.tsx IntersectionObserver and render queue).
  • The previews render once at build time and ship as static HTML with no client JavaScript for them: verified (TemplatesPreview.tsx and FrozenPreview.tsx are server components; ThemesPreview.tsx takes 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 (useMediaQuery in 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.mjs and its test).
  • Nothing is committed and every build and dev start renders the previews: verified (generate script; src/generated/ is gitignored).
  • No CI step or check is added, and the /templates gallery 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.tsx passes the previews to the client homepage, moved to HomePage.tsx: verified, with two new props.
  • esbuild is already a root dev dependency: verified (root package.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).

Automated review (maintainer link)

…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.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b9910fe

@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 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.tsx IntersectionObserver 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.tsx and FrozenPreview.tsx are server components; ThemesPreview.tsx takes 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 (useMediaQuery in those three templates; the forced desktop context moved from ThemesPreview.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 script; src/generated/ is gitignored); during next dev a template edit shows only after the next generate.
  • No CI step or check is added, and the /templates gallery 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.tsx passes the previews to the client homepage moved to HomePage.tsx, and the community page does the same: verified; the move adds only two pass-through props.
  • esbuild is already a root dev dependency: verified (root package.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).

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 06:44
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.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 7b84d2e

@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: 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 .viewport rules of TemplatePreviewSurface.module.css (lines 32-41) that the template dialog and gallery share, so give that stylesheet a second selector for the snapshot's preview-viewport wrapper under a class FrozenPreview applies, import it from FrozenPreview, 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 in previewSnapshotSources.tsx still renders the 704 px PNGs, resolve it by moving that images override 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.tsx visibility 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.tsx and FrozenPreview.tsx are server components, ThemesPreview.tsx takes 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 (useMediaQuery in those three templates; the forced desktop context moved from ThemesPreview.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, dev and build scripts; src/generated/ is gitignored).
  • No CI step or check is added, and the /templates gallery 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.tsx passes the previews to the client homepage moved to HomePage.tsx, and the community page does the same: verified; the move adds only two pass-through props.
  • esbuild is already a root dev dependency: verified (root package.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).

Automated review (maintainer link)

…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.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 1ec02c2

@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 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.mjs and lazy iframes, and this branch conflicts with it in apps/docsite/package.json, FeaturesShowcase.tsx and TemplatesPreview.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 .gitignore entries.

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.tsx visibility 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; TemplatesPreview and FrozenPreview are server components).
  • CSS scales the previews and they follow dark mode: verified (TemplatesPreview.tsx scaler; FrozenPreview.module.css sets color-scheme: inherit on 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 (finishSnapshotHtml and its test).
  • Nothing is committed and every build and dev start regenerates the snapshots: verified (generate, build and dev scripts; src/generated/ is ignored).
  • No CI step or check is added: verified.
  • The /templates gallery 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 dev option follows the shell's NODE_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, esbuild nodePaths).
  • The seven templates come from the template registry by a slug list TemplatesPreview also reads, in the Neutral theme, plus the Butter store, and the sources are read only by the script: verified.
  • FrozenPreview injects 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.tsx behind a thin server page, and the community page passes the previews the same way: verified (only the two pass-through props differ).
  • ThemesPreview takes the store as a prop and its swatch rail is unchanged: verified.
  • esbuild is declared from the existing root dev dependency: verified (catalog entry; the root package.json already 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's generate step (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.

Automated review (maintainer link)

Comment thread apps/docsite/package.json Resolved
…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]>
@cixzhang cixzhang changed the title perf(docsite): render decorative homepage previews once at build time perf(docsite): build the landing previews into the page instead of frames Nov 12, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 79179d0

@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 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-084 FR20 requires for each template preview source, so a docs-site build with DOCSITE_ICON_SET set shows the template's own icons in the store (generate-landing-template-previews.mjs:202-210); stage the store's template the way stagePreviewPage stages 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: TemplatesPreview and FrozenPreview are 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 (generate script, ignored src/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.json and lockfile changes. False: none exist at this revision.
  • Claim: FrozenPreview injects one snapshot whose theme wrapper inherits the page color scheme. Verified (FrozenPreview.module.css:5-7).
  • Claim: TemplatesPreview scales with the same CSS pattern as ThemesPreview. Verified (TemplatesPreview.tsx:140, ThemesPreview.tsx:132).
  • Claim: the client homepage moved unchanged to HomePage.tsx, and /community passes 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.mjs and ThemesStorePreview.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.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 12, 2026 11:55
@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 11:56
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.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 5ea31d5

@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: 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:140 drops main's tan(atan2()) and scale(0.25) fallback, so a browser without typed calc() division shows each tile's page unscaled (details inline).
  • .gitignore no longer ignores public/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: TemplatesPreview and FrozenPreview are 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.tsx renders a lazy, sandboxed frame per tile.
  • Claim: On main the themes-card store renders in the browser. Verified: main's ThemesPreview.tsx is 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 build and dev scripts run generate, and src/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: TemplatesPreview is 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.

Automated review (maintainer link)

Comment thread apps/docsite/.gitignore Resolved
…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.
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec a537f63

@cixzhang

Copy link
Copy Markdown
Contributor Author

Decision: D-20261112-413

@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: 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: TemplatesPreview and FrozenPreview are 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.tsx renders 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.tsx is 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 build and dev scripts run generate, and src/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: TemplatesPreview keeps the live tile's wrappers and scales with tan(atan2()) and a scale(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 ThemesPreview takes 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: .gitignore keeps 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.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as draft November 12, 2026 14:38
@cixzhang
cixzhang marked this pull request as ready for review November 12, 2026 14:39
@cixzhang
cixzhang merged commit 6e9fc3d into main Nov 12, 2026
119 of 122 checks passed
@github-actions
github-actions Bot deleted the perf/docsite-frozen-template-previews branch November 13, 2026 06:03

This branch was successfully deployed

1 active deployment
Preview — a537f635 Deployed Nov 12, 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