|
| 1 | +# RSC Migration Report |
| 2 | + |
| 3 | +Status: pre-ship bundle + code audit complete. Current production Lighthouse baseline captured. Post-deploy production compare still pending. |
| 4 | + |
| 5 | +## Scope |
| 6 | + |
| 7 | +This report tracks the impact of moving markdown-heavy and code-heavy surfaces to React Server Components and server-rendered code highlighting. |
| 8 | + |
| 9 | +Pages explicitly covered: |
| 10 | + |
| 11 | +- `/blog/react-server-components` |
| 12 | +- `/router/latest/docs/overview` |
| 13 | +- `/router/latest/docs/framework/react/examples/basic` |
| 14 | +- `/query/latest` |
| 15 | +- `/router/latest` |
| 16 | +- `/form/latest` |
| 17 | +- `/table/latest` |
| 18 | +- `/virtual/latest` |
| 19 | + |
| 20 | +## Methodology |
| 21 | + |
| 22 | +Bundle analysis: |
| 23 | + |
| 24 | +- Baseline: clean `HEAD` worktree at `/tmp/tanstack-bundle-baseline` |
| 25 | +- Current: this branch/worktree |
| 26 | +- Metric: transitive built client JS graph per representative route from production build assets |
| 27 | +- Unit: bytes and gzip bytes |
| 28 | + |
| 29 | +Production baseline metrics: |
| 30 | + |
| 31 | +- Captured against live `https://tanstack.com` |
| 32 | +- Tool: Lighthouse via `npx lighthouse` |
| 33 | +- Category: `performance` |
| 34 | +- Strategy: default Lighthouse mobile simulation |
| 35 | + |
| 36 | +Notes: |
| 37 | + |
| 38 | +- Bundle numbers are the most trustworthy pre-ship metric here |
| 39 | +- Lighthouse should be compared on the same production domain before and after deploy |
| 40 | +- Production Lighthouse is noisy; treat single-run numbers as directional until we rerun after deploy |
| 41 | + |
| 42 | +## Bundle Impact |
| 43 | + |
| 44 | +Gzipped client JS, before vs after. |
| 45 | + |
| 46 | +| Page | Before | After | Delta | |
| 47 | +|---|---:|---:|---:| |
| 48 | +| `/blog/react-server-components` | 547,196 B | 394,207 B | -152,989 B | |
| 49 | +| `/router/latest/docs/overview` | 563,295 B | 410,644 B | -152,651 B | |
| 50 | +| `/router/latest/docs/framework/react/examples/basic` | 421,421 B | 381,079 B | -40,342 B | |
| 51 | +| `/table/latest` | 451,744 B | 409,455 B | -42,289 B | |
| 52 | +| `/query/latest` | 405,185 B | 412,671 B | +7,486 B | |
| 53 | +| `/router/latest` | 403,281 B | 411,259 B | +7,978 B | |
| 54 | +| `/form/latest` | 401,951 B | 409,389 B | +7,438 B | |
| 55 | +| `/virtual/latest` | 401,535 B | 409,044 B | +7,509 B | |
| 56 | + |
| 57 | +### Bundle Takeaways |
| 58 | + |
| 59 | +- Big wins on markdown-heavy pages: |
| 60 | + - blog: about `-153 KB gz` |
| 61 | + - docs page: about `-153 KB gz` |
| 62 | +- Clear win on docs example page: about `-40 KB gz` |
| 63 | +- Clear win on table landing: about `-42 KB gz` |
| 64 | +- Slight regressions on most other landing pages: about `+7-8 KB gz` |
| 65 | + |
| 66 | +Interpretation: |
| 67 | + |
| 68 | +- The pages dominated by markdown parsing and client-side highlighting improved materially |
| 69 | +- Most landing pages are now architecturally cleaner, but not smaller yet |
| 70 | +- The likely reason for the small landing regressions is that the old landing code-example path had more lazy/client indirection, while the new server-rendered example shell is part of the initial experience |
| 71 | + |
| 72 | +## Client Boundary Audit |
| 73 | + |
| 74 | +Verified absent from current `dist/client/assets`: |
| 75 | + |
| 76 | +- `shiki` |
| 77 | +- `@shikijs/*` |
| 78 | +- `createHighlighter` |
| 79 | +- `codeToHtml` |
| 80 | +- `html-react-parser` |
| 81 | +- `remark-*` |
| 82 | +- `rehype-*` |
| 83 | +- `rehype-react` |
| 84 | +- old client markdown renderer files |
| 85 | +- old landing example card files |
| 86 | +- representative raw example-source snippets |
| 87 | + |
| 88 | +Implications: |
| 89 | + |
| 90 | +- Markdown rendering pipeline is out of the client build |
| 91 | +- Syntax highlighting pipeline is out of the client build |
| 92 | +- Landing example source strings are out of the client build |
| 93 | + |
| 94 | +Runtime spot checks also confirmed: |
| 95 | + |
| 96 | +- docs/example pages no longer request Shiki/highlighting assets |
| 97 | +- landing pages no longer hit the old client `CodeBlock` path |
| 98 | + |
| 99 | +Nuance: |
| 100 | + |
| 101 | +- Client sourcemaps still reference some server-fn stub names like `fetchRenderedCodeFile` and `fetchLandingCodeExample` |
| 102 | +- Those are stubs, not the rendering/highlighting pipeline itself |
| 103 | + |
| 104 | +## Code Simplicity |
| 105 | + |
| 106 | +Git diff summary: |
| 107 | + |
| 108 | +- `46 files changed` |
| 109 | +- `1,017 insertions` |
| 110 | +- `2,038 deletions` |
| 111 | +- Net: about `-1,021` lines |
| 112 | + |
| 113 | +Deleted legacy client-heavy files: |
| 114 | + |
| 115 | +- `src/components/CodeExampleCard.tsx` |
| 116 | +- `src/components/LazyCodeExampleCard.tsx` |
| 117 | +- `src/components/SimpleMarkdown.tsx` |
| 118 | +- `src/components/markdown/Markdown.tsx` |
| 119 | +- `src/components/markdown/MarkdownFrameworkHandler.tsx` |
| 120 | +- `src/components/markdown/MarkdownTabsHandler.tsx` |
| 121 | +- `src/utils/markdown/processor.ts` |
| 122 | + |
| 123 | +New server-focused structure: |
| 124 | + |
| 125 | +- `src/components/markdown/renderCodeBlock.server.tsx` |
| 126 | +- `src/components/markdown/CodeBlock.server.tsx` |
| 127 | +- `src/utils/markdown/processor.rsc.tsx` |
| 128 | +- `src/utils/markdown/renderRsc.tsx` |
| 129 | +- `src/components/landing/codeExamples.server.tsx` |
| 130 | +- `src/components/landing/LandingCodeExampleCard.server.tsx` |
| 131 | + |
| 132 | +Dependency cleanup: |
| 133 | + |
| 134 | +- Removed `html-react-parser` |
| 135 | +- Removed `rehype-stringify` |
| 136 | + |
| 137 | +Architectural simplifications: |
| 138 | + |
| 139 | +- One server markdown pipeline instead of mixed client/server rendering |
| 140 | +- One server code-highlighting pipeline instead of client Shiki |
| 141 | +- One server landing-example registry instead of repeating large inline code maps across landing pages |
| 142 | +- Example pages now use URL-driven server-rendered code panes instead of client raw source + client highlighting |
| 143 | + |
| 144 | +## Current Production Lighthouse Baseline |
| 145 | + |
| 146 | +Captured before shipping these changes. |
| 147 | + |
| 148 | +| Page | Score | FCP | LCP | Speed Index | TBT | CLS | Interactive | Bytes | Requests | |
| 149 | +|---|---:|---:|---:|---:|---:|---:|---:|---:|---:| |
| 150 | +| `/query/latest` | 80 | 2.8s | 3.4s | 3.4s | 300ms | 0.001 | 6.1s | 765 KiB | 89 | |
| 151 | +| `/blog/react-server-components` | 52 | 3.3s | 3.7s | 3.6s | 1,200ms | 0.15 | 7.8s | 1,101 KiB | 60 | |
| 152 | +| `/router/latest/docs/overview` | 78 | 3.0s | 3.6s | 3.9s | 280ms | 0.002 | 7.5s | 917 KiB | 81 | |
| 153 | + |
| 154 | +Notes: |
| 155 | + |
| 156 | +- These are single-run live production baselines, so expect some noise |
| 157 | +- Blog is the most likely page to show strong post-deploy Lighthouse improvement because it had the largest client-bundle reduction |
| 158 | +- Docs should also improve meaningfully |
| 159 | +- Landing-page Lighthouse changes may be neutral or mixed except for table, based on current bundle data |
| 160 | + |
| 161 | +## Post-Deploy Compare |
| 162 | + |
| 163 | +Fill this in after deploy to `main` and re-run Lighthouse on the same production URLs. |
| 164 | + |
| 165 | +| Page | Before Score | After Score | Before LCP | After LCP | Before TBT | After TBT | Before Bytes | After Bytes | Notes | |
| 166 | +|---|---:|---:|---:|---:|---:|---:|---:|---:|---| |
| 167 | +| `/query/latest` | 80 | | 3.4s | | 300ms | | 765 KiB | | | |
| 168 | +| `/blog/react-server-components` | 52 | | 3.7s | | 1,200ms | | 1,101 KiB | | | |
| 169 | +| `/router/latest/docs/overview` | 78 | | 3.6s | | 280ms | | 917 KiB | | | |
| 170 | + |
| 171 | +## Conclusions So Far |
| 172 | + |
| 173 | +- Strong technical wins on markdown-heavy and code-heavy content pages |
| 174 | +- Clear reduction in client responsibility and code complexity |
| 175 | +- Clear removal of markdown parsing and syntax highlighting from the client bundle |
| 176 | +- Not a universal bundle win across all landing pages yet |
| 177 | +- Best pages to watch post-deploy: blog and docs |
0 commit comments