fix: remote script#346
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
react-server-docs | d4faffc | Mar 08 2026, 11:24 AM |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #346 +/- ##
=======================================
Coverage ? 94.18%
=======================================
Files ? 2
Lines ? 2234
Branches ? 677
=======================================
Hits ? 2104
Misses ? 130
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Problem
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."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
dom-flight.mjswas passing<script>nodes through as regular JSX elements.The
@lazarv/rsccustom Flight serializer had two issues: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/toBuffernever passeddebug: trueto the serializer, so it emitted 4-element production tuples. The dev-mode Flight client readstuple[6]asundefined(= 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— Emitelement._store.validated(notdebugCounter) at tuple position 6 in dev mode. Mark keyless Fragment children withvalidated = 2to match React'srenderFragmentbehavior.cache/rsc.mjs/cache/rsc-browser.mjs— Passdebug: truein dev mode so the serializer emits full 7-element dev tuples with correct_store.validatedvalues.bin/commands/dev.mjs/lib/dev/create-server.mjs— Add--originand--trust-proxyCLI options for reverse proxy support.docs/— Document the new--originand--trust-proxyCLI options (en + ja).