You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Problem
1. **React "Encountered a script tag" warning** — Remote components
returning `<script>` tags (e.g. import maps, `__flightStream__` globals)
caused React to warn during RSC rendering, since React's Float system
does not allow `<script>` elements in JSX.
2. **"Each child in a list should have a unique key prop" warning** —
Live components (`"use live"`) emitted spurious missing-key warnings for
every keyless element, even when keys weren't required.
### Root Cause
1. `dom-flight.mjs` was passing `<script>` nodes through as regular JSX
elements.
2. The `@lazarv/rsc` custom Flight serializer had two issues:
- It wrote `debugCounter` (an incrementing number) at position 6 of the
dev element tuple, where React's Flight client expects
`_store.validated`. This caused every deserialized element to have an
incorrect validation state.
- `toStream`/`toBuffer` never passed `debug: true` to the serializer, so
it emitted 4-element production tuples. The dev-mode Flight client reads
`tuple[6]` as `undefined` (= not validated), triggering key
re-validation on all elements.
### Changes
- **`server/dom-flight.mjs`** — Convert `<script>` nodes to `<template
data-script-attrs>` during Flight serialization to avoid React's script
tag warning.
- **`client/ReactServerComponent.jsx`** — Activate script templates
(create real `<script>` elements from templates) before Flight hydration
and on navigation, supporting both document and shadow DOM roots.
- **`packages/rsc/server/shared.mjs`** — Emit `element._store.validated`
(not `debugCounter`) at tuple position 6 in dev mode. Mark keyless
Fragment children with `validated = 2` to match React's `renderFragment`
behavior.
- **`cache/rsc.mjs` / `cache/rsc-browser.mjs`** — Pass `debug: true` in
dev mode so the serializer emits full 7-element dev tuples with correct
`_store.validated` values.
- **`bin/commands/dev.mjs` / `lib/dev/create-server.mjs`** — Add
`--origin` and `--trust-proxy` CLI options for reverse proxy support.
- **`docs/`** — Document the new `--origin` and `--trust-proxy` CLI
options (en + ja).
Copy file name to clipboardExpand all lines: docs/src/pages/en/(pages)/features/cli.mdx
+18-6Lines changed: 18 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,12 +62,6 @@ Use HTTPS protocol. Default is `false`.
62
62
63
63
When you want to use HTTPS for your development server. You need to specify your HTTPS configuration in your `react-server.config.mjs` or `vite.config.mjs` file. See details in the Vite documentation at [server.https](https://vitejs.dev/config/server-options.html#server-https).
64
64
65
-
<Linkname="dev-open">
66
-
### --open
67
-
</Link>
68
-
69
-
Open browser on server start. Default is `false`. Opens your app in the default browser.
70
-
71
65
<Linkname="dev-cors">
72
66
### --cors
73
67
</Link>
@@ -76,6 +70,24 @@ Enable CORS. Default is `false`.
76
70
77
71
This is useful when you want to allow cross-origin requests. If you need more detailed CORS configuration, you can define the CORS configuration in your `react-server.config.mjs` or `vite.config.mjs` file. See details in the Vite documentation at [server.cors](https://vitejs.dev/config/server-options.html#server-cors).
78
72
73
+
<Linkname="dev-origin">
74
+
### --origin
75
+
</Link>
76
+
77
+
Specify the origin part of the URL to a constant value. Same as using the `ORIGIN` environment variable.
78
+
79
+
<Linkname="dev-trust-proxy">
80
+
### --trust-proxy
81
+
</Link>
82
+
83
+
Trust `X-Forwarded-*` headers.
84
+
85
+
<Linkname="dev-open">
86
+
### --open
87
+
</Link>
88
+
89
+
Open browser on server start. Default is `false`. Opens your app in the default browser.
0 commit comments