Commit f1fa1d7
Pro RSC migration 3/3: React Server Components demo on webpack
Adds a React Server Components demo page at /server-components, riding
on top of Sub-PR 2's NodeRenderer + webpack setup.
The page demonstrates four RSC capabilities:
- Server Environment: ServerInfo reads Node's `os` module and lodash on
the server; neither reaches the browser.
- Interactive Client Component: a 'use client' TogglePanel nested
inside a Server Component tree, demonstrating the donut pattern.
- Live Server Activity: client-driven server-component re-fetching via
useRSC().refetchComponent + RSCRoute, with react-error-boundary
catching simulated errors and a Retry button that re-primes the cache
before resetting the boundary. Local Suspense fallback prevents the
in-flight RSC fetch from collapsing the page.
- Streamed Comments: async Server Component receiving comments as
props from the controller per the canonical Pro data-fetching
pattern, streaming in via Suspense after the page shell.
Renderer config (renderer/node-renderer.js) needs stubTimers: false
(the default `true` no-ops setTimeout, which React's RSC server
renderer uses for Flight-protocol yielding — without the override, RSC
streams emit zero chunks and hang until the idle timeout fires) and
replayServerAsyncOperationLogs: true (surfaces async-Server-Component
console output through consoleReplayScript).
Build setup uses upstream RSCWebpackPlugin and WebpackLoader. The RSC
bundle reuses the server-bundle entry; entry name, RSC loader injection,
and a few resolve overrides (react-server condition,
react-dom/server: false) are the only differences from the SSR build.
The webpack-config dispatch gains an RSC_BUNDLE_ONLY env-var gate
matching the existing SERVER_BUNDLE_ONLY / CLIENT_BUNDLE_ONLY pattern;
default builds now produce three bundles (client + server + RSC).
Covered by request + system specs at
spec/requests/server_components_spec.rb and
spec/system/server_components_demo_spec.rb.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 767c513 commit f1fa1d7
31 files changed
Lines changed: 714 additions & 4 deletions
File tree
- .controlplane/templates
- app
- controllers
- views/pages
- client/app
- bundles
- comments
- components
- SimpleCommentScreen/ror_components
- constants
- rescript/ReScriptShow/ror_components
- startup
- App/ror_components
- RouterApp/ror_components
- server-components
- components
- ror_components
- packs
- config
- initializers
- webpack
- renderer
- spec
- requests
- system
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
37 | 41 | | |
38 | 42 | | |
39 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
15 | 17 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
41 | 48 | | |
42 | 49 | | |
43 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
105 | 113 | | |
106 | 114 | | |
107 | 115 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
0 commit comments