Moves the app to TanStack Start with prerendering

Every page is now built as HTML from sitePages.ts, with a catch-all route for
404.html. Hooks that read the browser during render are safe for prerendering.
The script step that keeps the CSP intact follows, so this build still has
inline scripts and is not deployable yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-31 17:58:54 +01:00
co-authored by Claude Opus 5.5
parent 65c850e949
commit c1e90f0768
33 changed files with 746 additions and 269 deletions
@@ -0,0 +1,33 @@
# Proof report: Start on the real app (Steps 3 to 6)
Date 2026-10-31. Details and evidence per point: [verification-log.md](verification-log.md).
## Outcome
`pnpm build` (tsc, Vite with Start, prerender) is green and writes 12 HTML files plus `sitemap.xml` into `dist/client`. `pnpm test` is green (113 files, 888 tests, same counts as the baseline). `pnpm lint`, `pnpm format:check` and `pnpm audit:deps` are green. V1, V2, V5, V6 and V7 are OK; there is no blocker for the parallel batches.
## Per point
- **V1 client entry**: Start uses `src/client.tsx` by file name; it calls `startSentry()` and then `hydrateRoot(document, <StrictMode><StartClient/></StrictMode>)`. Pages hydrate in Chrome without console errors (`/`, `/over-mij`, `/contact`, `/contact?pakket=gezin`).
- **V2 shell in jsdom**: Router does render `shellComponent`, but React 19 keeps `html`/`head`/`body` out of the container; it does set `lang` on the test document and double-wraps `ChakraProvider`. `renderApp` therefore gives its router a test shell (`HeadContent` + children). All old tests pass.
- **V3 inline scripts**: every page has the scroll-restoration script (613 chars), Start's bootstrap (`data-tsr-stream-part`, 916 to 1349 chars) and the boundary script (56 chars); `/contact` also has `<script id="_R_">requestAnimationFrame(...)` and the React completion runtime (845 chars). No `<!--`, no `async`/`defer` on inline scripts, no inline module scripts. JSON-LD blocks are data and stay.
- **V5 pages**: exactly the 11 pages plus `404.html`; `autoSubfolderIndex: false`, `crawlLinks: false`, `autoStaticPathsDiscovery: false`.
- **V6 splitting**: built into Start's plugin (one chunk per route); `@tanstack/router-plugin` removed as direct dependency.
- **V7 sitemap**: `this.environment.name === 'client'` works; one `sitemap.xml` in `dist/client`.
## Resolved dependency versions
`@tanstack/react-start` 1.169.4, `@tanstack/react-router` 1.170.46, `@tanstack/router-core` 1.171.39, `@tanstack/start-plugin-core` 1.171.55, `playwright-core` 1.55.0, vite 8.3.1, zod 4.6.7 (override).
## Deviations from the design text (for the main session to confirm)
1. `pnpm-workspace.yaml`: new scoped override `zod@4: ^4.6.6` because `pnpm audit:deps` reported a high advisory (zod < 4.6.6) in Start's dependency tree. Patch bump only.
2. `@tanstack/react-router` raised from `^1.170.39` to `1.170.46` (the plan's fallback) to avoid two router copies.
3. `src/navigation.ts`: `RoutePath` excludes `/$`, otherwise the page register would need an entry for the catch-all.
4. `renderApp` uses a test shell instead of dropping `shellComponent` (the shell is rendered by Router in jsdom without error, so the plan's "variant" is a variant of the shell, not of the route tree).
5. Old tests changed (BR-TST-02): `usePageLoaded.test.tsx` and `DeferredImage.test.tsx` (the mocked `readyState` stays `interactive` when the `load` event is dispatched; with a store-based hook the snapshot must change too, as it does in a real browser), `useReveal.test.tsx` (the first render now assumes no reduced motion, so an observer starts and is stopped again at once; the test now expects all observers disconnected instead of none created), `app.test.tsx` (register test ignores the catch-all `/$`).
## Things seen that later steps must handle
- Before Step 16, `/soorten-fotoshoots/onbekend` and `/portfolio?shoot=gezin` give React error #418 in Chrome (expected, those are Step 16 changes); the former also ends with two `<title>` and two robots metas after the client re-render.
- The e-mail address is in all 12 HTML files until Step 17.