perf(landing): keep codec off landing via build-time precompute (reworked P1)#300
Merged
Conversation
…m client DemoSection no longer loads brotli-wasm or @/features/invoice-codec at runtime. createHash strings are generated once during `pnpm build` (prebuild npm hook) via scripts/generate-demo-hashes.ts + a Node zlib brotli stub that replaces brotli-wasm for the build-time script. DemoSection imports static data + the generated demo-invoices.generated.ts module — synchronous, no useEffect async loading. This reverts the #296 RSC lift (which regressed LCP +1.4s / SI +1.8s) while still keeping brotli-wasm off the landing client bundle. Files: - scripts/generate-demo-hashes.ts — prebuild script that writes createHash strings - scripts/brotli-node-stub.ts — Node zlib brotli shim for the prebuild tsconfig - scripts/tsconfig.prebuild.json — tsconfig alias: brotli-wasm → brotli-node-stub - src/widgets/landing/constants/demo-invoices.ts — exports RAW_DEMO_INVOICES + buildDemoInvoices() - src/widgets/landing/constants/demo-invoices.generated.ts — placeholder (overwritten at build) - src/widgets/landing/demo-section/DemoSection.tsx — imports static data, no codec - src/widgets/landing/demo-section/__tests__/DemoSection.test.tsx — updated for static shape
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This was referenced Jun 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What (reworked P1 — replaces the held #296 P1)
Keep the brotli-wasm codec off the landing without the LCP regression that #296's RSC-lift caused.
createHashat build time: a prebuild step runsencodeInvoiceoverRAW_DEMO_INVOICESin Node and emitsdemo-invoices.generated.ts(static strings, committed). Salt is frozen at build (fine for demos).DemoSectionimports only static raw data + precomputed hashes — no@/features/invoice-codec, nogetDemoInvoices(). The RSC lift inpage.tsx/LandingContent/BelowFoldSectionsis reverted (back to non-async, no prop threading). DemoSection loads lazily client-side below the fold, as before perf(landing): stop eager 2.7MB video + 581KB codec on mobile landing #296 — so demo content is NOT in the critical render path.Why (official PSI, mobile, 3× median)
Reverting the RSC lift brings LCP 5.4 → 4.2 (back to develop baseline) while keeping wasm off the landing (codec goal achieved). This isolates and confirms #296's RSC lift as the LCP regression cause.
media=1here is the autoplay video (this branch is off develop, without P0). P0 (#299) removes it; the two are independent and compose on develop.Verification
Pending Iris quality-gate (pipeline + prebuild mechanism + tests).
🤖 Generated with Claude Code