Skip to content

Commit eed3206

Browse files
justin808claude
andcommitted
Address PR #4080 review findings for the stable RSC pin (#3634)
- CHANGELOG: fix the changelog entry's PR link to point at PR 4080 (was pointing at the issue URL /pull/3634); keep Closes Issue 3634. - Generator messaging: make rsc_dependency_pin_info and rsc_dependency_pin_failed_warning conditional on whether RSC_PACKAGE_VERSION_PIN is a prerelease (contains "-"). A prerelease pin keeps the existing "temporarily / this prerelease / until stable {target} is published" wording; the now-stable 19.0.5 pin uses accurate wording with no prerelease/temporary framing. Add a stable-pin spec asserting the messages omit prerelease wording, and update the install_generator_spec expectation accordingly. - Docs: reword the React-19.0.x NOTE in create-without-ssr.md and upgrading-existing-pro-app.md to state the generator pins react-on-rails-rsc to exactly 19.0.5 (no ^/~) and that manual installers should record it as exactly 19.0.5 because the RSC bundler APIs are version-coupled, while react/react-dom stay on ~19.0.4. Regenerate llms-full-pro.txt to mirror the doc edits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 111e644 commit eed3206

6 files changed

Lines changed: 56 additions & 20 deletions

File tree

docs/pro/react-server-components/create-without-ssr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ yarn add react@~19.0.4 react-dom@~19.0.4 react-on-rails-rsc@19.0.5
3535
> [!NOTE]
3636
> React on Rails Pro RSC currently supports React 19.0.x with patch >= 19.0.4. Do not upgrade generated RSC apps to React 19.1 or 19.2 just because those versions are newer on npm; the RSC bundler APIs used internally can change between React minor versions. See the [React documentation on Server Components](https://react.dev/reference/rsc/server-components#how-do-i-build-support-for-server-components) for details.
3737
>
38-
> The example above pins the stable `react-on-rails-rsc@19.0.5` release exactly, matching the generator default.
38+
> The generator pins `react-on-rails-rsc` to exactly `19.0.5` (no `^` or `~`), matching the generator default. Because the RSC bundler APIs are version-coupled, manual installers should record `react-on-rails-rsc` as exactly `19.0.5` in `package.json` rather than the default caret range; `react` and `react-dom` stay on `~19.0.4`.
3939
4040
2. Enable support for Server Components in React on Rails Pro configuration:
4141

docs/pro/react-server-components/upgrading-existing-pro-app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pnpm add react@~19.0.4 react-dom@~19.0.4 react-on-rails-rsc@19.0.5
3434
> The RSC generator intentionally stays on React 19.0.x and does not widen generated apps to React 19.1 or 19.2 yet. React's RSC runtime and bundler APIs can change between minor releases, so advance the React range only when the generator, docs, and package metadata policy are reviewed together.
3535
3636
> [!NOTE]
37-
> `react-on-rails-rsc@19.0.5` is the exact stable pin used by the generator. This is separate from the Pro package peer metadata tracked in [issue #3609](https://github.com/shakacode/react_on_rails/issues/3609): metadata can allow RSC packages broadly enough for `npm ls`, while the generator still installs the tested exact RSC package pin.
37+
> The generator pins `react-on-rails-rsc` to exactly `19.0.5` (no `^` or `~`). Because the RSC bundler APIs are version-coupled, record `react-on-rails-rsc` as exactly `19.0.5` in `package.json` rather than the default caret range so a later `19.1.x`/`19.2.x` is not picked up; `react` and `react-dom` stay on `~19.0.4`. This is separate from the Pro package peer metadata tracked in [issue #3609](https://github.com/shakacode/react_on_rails/issues/3609): metadata can allow RSC packages broadly enough for `npm ls`, while the generator still installs the tested exact RSC package pin.
3838
3939
## Pre-Migration: Audit Components for Client API Usage
4040

llms-full-pro.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6359,7 +6359,7 @@ yarn add react@~19.0.4 react-dom@~19.0.4 react-on-rails-rsc@19.0.5
63596359
> [!NOTE]
63606360
> React on Rails Pro RSC currently supports React 19.0.x with patch >= 19.0.4. Do not upgrade generated RSC apps to React 19.1 or 19.2 just because those versions are newer on npm; the RSC bundler APIs used internally can change between React minor versions. See the [React documentation on Server Components](https://react.dev/reference/rsc/server-components#how-do-i-build-support-for-server-components) for details.
63616361
>
6362-
> The example above pins the stable `react-on-rails-rsc@19.0.5` release exactly, matching the generator default.
6362+
> The generator pins `react-on-rails-rsc` to exactly `19.0.5` (no `^` or `~`), matching the generator default. Because the RSC bundler APIs are version-coupled, manual installers should record `react-on-rails-rsc` as exactly `19.0.5` in `package.json` rather than the default caret range; `react` and `react-dom` stay on `~19.0.4`.
63636363

63646364
2. Enable support for Server Components in React on Rails Pro configuration:
63656365

@@ -7951,7 +7951,7 @@ pnpm add react@~19.0.4 react-dom@~19.0.4 react-on-rails-rsc@19.0.5
79517951
> The RSC generator intentionally stays on React 19.0.x and does not widen generated apps to React 19.1 or 19.2 yet. React's RSC runtime and bundler APIs can change between minor releases, so advance the React range only when the generator, docs, and package metadata policy are reviewed together.
79527952

79537953
> [!NOTE]
7954-
> `react-on-rails-rsc@19.0.5` is the exact stable pin used by the generator. This is separate from the Pro package peer metadata tracked in [issue #3609](https://github.com/shakacode/react_on_rails/issues/3609): metadata can allow RSC packages broadly enough for `npm ls`, while the generator still installs the tested exact RSC package pin.
7954+
> The generator pins `react-on-rails-rsc` to exactly `19.0.5` (no `^` or `~`). Because the RSC bundler APIs are version-coupled, record `react-on-rails-rsc` as exactly `19.0.5` in `package.json` rather than the default caret range so a later `19.1.x`/`19.2.x` is not picked up; `react` and `react-dom` stay on `~19.0.4`. This is separate from the Pro package peer metadata tracked in [issue #3609](https://github.com/shakacode/react_on_rails/issues/3609): metadata can allow RSC packages broadly enough for `npm ls`, while the generator still installs the tested exact RSC package pin.
79557955

79567956
## Pre-Migration: Audit Components for Client API Usage
79577957

react_on_rails/lib/generators/react_on_rails/js_dependency_manager.rb

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -488,23 +488,42 @@ def rsc_stable_package_version_target
488488
RSC_PACKAGE_VERSION_PIN.split("-", 2).first
489489
end
490490

491+
def rsc_package_version_prerelease?
492+
RSC_PACKAGE_VERSION_PIN.include?("-")
493+
end
494+
491495
def rsc_dependency_pin_info
492-
"React Server Components package pin: all --rsc installs temporarily use " \
493-
"react-on-rails-rsc@#{RSC_PACKAGE_VERSION_PIN}, including Webpack projects. " \
494-
"This prerelease keeps react-on-rails-rsc/WebpackPlugin compatible while adding " \
495-
"react-on-rails-rsc/RspackPlugin. Keep the pin until stable " \
496-
"react-on-rails-rsc@#{rsc_stable_package_version_target} " \
497-
"is published and tagged latest."
496+
if rsc_package_version_prerelease?
497+
"React Server Components package pin: all --rsc installs temporarily use " \
498+
"react-on-rails-rsc@#{RSC_PACKAGE_VERSION_PIN}, including Webpack projects. " \
499+
"This prerelease keeps react-on-rails-rsc/WebpackPlugin compatible while adding " \
500+
"react-on-rails-rsc/RspackPlugin. Keep the pin until stable " \
501+
"react-on-rails-rsc@#{rsc_stable_package_version_target} " \
502+
"is published and tagged latest."
503+
else
504+
"React Server Components package pin: all --rsc installs use " \
505+
"react-on-rails-rsc@#{RSC_PACKAGE_VERSION_PIN}, including Webpack projects. " \
506+
"This pin keeps react-on-rails-rsc/WebpackPlugin compatible while adding " \
507+
"react-on-rails-rsc/RspackPlugin."
508+
end
498509
end
499510

500511
def rsc_dependency_pin_failed_warning
501-
"Warning: Could not install the pinned react-on-rails-rsc@#{RSC_PACKAGE_VERSION_PIN}. " \
502-
"All RSC projects are temporarily pinned to that version: the prerelease keeps " \
503-
"react-on-rails-rsc/WebpackPlugin compatible while adding react-on-rails-rsc/RspackPlugin, " \
504-
"and the unversioned `latest` tag may not include both until stable " \
505-
"#{rsc_stable_package_version_target} " \
506-
"is published, so the generator left the version pin in package.json rather than " \
507-
"install a potentially incompatible version."
512+
if rsc_package_version_prerelease?
513+
"Warning: Could not install the pinned react-on-rails-rsc@#{RSC_PACKAGE_VERSION_PIN}. " \
514+
"All RSC projects are temporarily pinned to that version: the prerelease keeps " \
515+
"react-on-rails-rsc/WebpackPlugin compatible while adding react-on-rails-rsc/RspackPlugin, " \
516+
"and the unversioned `latest` tag may not include both until stable " \
517+
"#{rsc_stable_package_version_target} " \
518+
"is published, so the generator left the version pin in package.json rather than " \
519+
"install a potentially incompatible version."
520+
else
521+
"Warning: Could not install the pinned react-on-rails-rsc@#{RSC_PACKAGE_VERSION_PIN}. " \
522+
"All RSC projects are pinned to that version: this pin keeps " \
523+
"react-on-rails-rsc/WebpackPlugin compatible while adding react-on-rails-rsc/RspackPlugin, " \
524+
"so the generator left the version pin in package.json rather than " \
525+
"install a potentially incompatible version."
526+
end
508527
end
509528

510529
def rsc_dependency_pin_failure_details(used_version_pins)

react_on_rails/spec/react_on_rails/generators/install_generator_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,25 +2478,26 @@ class ActiveSupport::TestCase
24782478
describe "#add_rsc_dependencies" do
24792479
let(:install_generator) { described_class.new([], { rsc: true }, destination_root:) }
24802480
let(:rsc_pin) { ReactOnRails::Generators::JsDependencyManager::RSC_PACKAGE_VERSION_PIN }
2481-
let(:rsc_stable_target) { install_generator.send(:rsc_stable_package_version_target) }
24822481

24832482
before do
24842483
GeneratorMessages.clear
24852484
allow(install_generator).to receive(:say)
24862485
allow(install_generator).to receive(:fallback_package_manager).and_return("pnpm")
24872486
end
24882487

2489-
it "explains why every RSC install is temporarily pinned to the prerelease package" do
2488+
it "explains why every RSC install is pinned to the stable package" do
24902489
allow(install_generator).to receive(:add_packages).and_return(true)
24912490

24922491
install_generator.send(:add_rsc_dependencies)
24932492

24942493
message_text = GeneratorMessages.messages.join("\n")
24952494
expect(message_text).to include("all --rsc installs")
24962495
expect(message_text).to include("react-on-rails-rsc@#{rsc_pin}")
2497-
expect(message_text).to include("stable react-on-rails-rsc@#{rsc_stable_target}")
24982496
expect(message_text).to include("react-on-rails-rsc/RspackPlugin")
24992497
expect(message_text).to include("Webpack")
2498+
expect(message_text).not_to include("prerelease")
2499+
expect(message_text).not_to include("temporarily")
2500+
expect(message_text).not_to include("until stable")
25002501
end
25012502

25022503
it "keeps the version pin and uses the detected package manager when manual RSC recovery is needed" do

react_on_rails/spec/react_on_rails/generators/js_dependency_manager_spec.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,22 @@ def errors
738738
expect(warning).to include("stable 19.1.0")
739739
expect(warning).not_to include("stable 19.0.5")
740740
end
741+
742+
it "uses accurate messaging without prerelease wording for a stable package pin" do
743+
expect(ReactOnRails::Generators::JsDependencyManager::RSC_PACKAGE_VERSION_PIN).to eq("19.0.5")
744+
745+
info = instance.send(:rsc_dependency_pin_info)
746+
warning = instance.send(:rsc_dependency_pin_failed_warning)
747+
748+
[info, warning].each do |message|
749+
expect(message).to include("react-on-rails-rsc@19.0.5")
750+
expect(message).to include("react-on-rails-rsc/WebpackPlugin")
751+
expect(message).to include("react-on-rails-rsc/RspackPlugin")
752+
expect(message).not_to include("prerelease")
753+
expect(message).not_to include("temporarily")
754+
expect(message).not_to include("until stable")
755+
end
756+
end
741757
end
742758

743759
describe "#add_rsc_dependencies" do

0 commit comments

Comments
 (0)