chore: rename generated layout hello_world → react_on_rails_default#2482
chore: rename generated layout hello_world → react_on_rails_default#2482
Conversation
stream_react_component unconditionally forces prerender internally and ignores any caller-supplied value. The template was passing prerender: true with a comment claiming it "enables server-side rendering with streaming", which is false — streaming is always enabled regardless. Remove the redundant option and correct the comment. Also strengthen the install generator spec to assert the generated view does not include prerender: true.
generator_messages.rb had an inline if/else for render_label while the adjacent render_example already delegated to a private build_render_example method. Extract to build_render_label for consistency. The three --rsc --redux/--typescript/--rspack contexts each had an identical inline it block asserting HelloServerController content. Replace all four (including the base --rsc context) with a shared example that also covers the hello_server view, giving the combination contexts view coverage for free.
…or templates The layout's purpose is to provide empty pack tags for React on Rails auto-registration — it has no semantic connection to the HelloWorld demo. In RSC-only installs, HelloServerController uses it with no HelloWorld controller in sight, making the name confusing. Rename the generator template file and update both controller templates and base_generator.rb to reference react_on_rails_default.
WalkthroughRenames the generator layout from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryRenamed the generator layout from Key changes:
Issue found:
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: ede7f4f |
Code ReviewOverall this is a well-scoped rename with a clear rationale. The rename is applied consistently across generator templates, spec files, and the Bundled unrelated changesThe PR title says "rename layout", but three additional concerns are folded in:
None of these are blockers; they're all improvements. Just flagging for awareness. Test coverage gapsNon-RSC layout file not asserted. The four contexts that
Minor nit: CHANGELOG orderingThe new "Changed" section is placed before the existing "Fixed" section, which matches the conventional Keep-a-Changelog order ( |
react_on_rails/spec/react_on_rails/support/shared_examples/rsc_generator_examples.rb
Show resolved
Hide resolved
...rails/lib/generators/react_on_rails/templates/rsc/base/app/views/hello_server/index.html.erb
Show resolved
Hide resolved
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Line 36: Update the Unreleased changelog entry for PR `#2429` to reflect the
rename from hello_world to react_on_rails_default introduced in PR `#2482`:
replace references to hello_world.html.erb and layout "hello_world" with
react_on_rails_default (e.g., the generator now always copies
react_on_rails_default.html.erb and HelloServerController uses layout
"react_on_rails_default") and ensure the sentence about post-install output
still mentioning stream_react_component is preserved or adjusted as needed to
match the final behavior.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (11)
CHANGELOG.mdreact_on_rails/lib/generators/react_on_rails/base_generator.rbreact_on_rails/lib/generators/react_on_rails/generator_messages.rbreact_on_rails/lib/generators/react_on_rails/templates/base/base/app/controllers/hello_world_controller.rbreact_on_rails/lib/generators/react_on_rails/templates/base/base/app/views/layouts/react_on_rails_default.html.erbreact_on_rails/lib/generators/react_on_rails/templates/rsc/base/app/controllers/hello_server_controller.rbreact_on_rails/lib/generators/react_on_rails/templates/rsc/base/app/views/hello_server/index.html.erbreact_on_rails/spec/react_on_rails/generators/install_generator_spec.rbreact_on_rails/spec/react_on_rails/support/shared_examples/rsc_generator_examples.rbreact_on_rails_pro/spec/execjs-compatible-dummy/app/controllers/hello_world_controller.rbreact_on_rails_pro/spec/execjs-compatible-dummy/app/views/layouts/react_on_rails_default.html.erb
…or specs - Update PR 2429 Fixed entry in CHANGELOG to reference react_on_rails_default instead of hello_world (both PRs ship in the same release) - Add app/views/layouts/react_on_rails_default.html.erb to base_generator_common "copies common files" assertion (covers all non-RSC flag combinations) - Add "creates HelloWorld controller with react_on_rails_default layout" it block to base_generator_common to assert the layout declaration in the generated controller Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code ReviewThis is a clean, well-executed rename. The change is correctly scoped and the implementation is consistent across all relevant files. Correctness
All layout references are updated. No stray CHANGELOG is correct. The PR 2429 entry was also updated to use the new name — the greptile bot's comment about a CHANGELOG inconsistency is incorrect. Test QualityThe refactoring to The new No Issues Found
|
react_on_rails/spec/react_on_rails/support/shared_examples/rsc_generator_examples.rb
Show resolved
Hide resolved
There was a problem hiding this comment.
🧹 Nitpick comments (1)
react_on_rails/spec/react_on_rails/support/shared_examples/base_generator_examples.rb (1)
22-26: Make the layout assertion tolerant to quote style.This test will fail if the template uses single quotes or slightly different spacing. A regex keeps the intent while reducing brittleness.
🔧 Suggested tweak
- assert_file "app/controllers/hello_world_controller.rb" do |content| - expect(content).to include('layout "react_on_rails_default"') - end + assert_file "app/controllers/hello_world_controller.rb" do |content| + expect(content).to match(/layout\s+["']react_on_rails_default["']/) + end🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@react_on_rails/spec/react_on_rails/support/shared_examples/base_generator_examples.rb` around lines 22 - 26, The assertion for the controller layout is brittle to quote style and spacing; replace the literal include check inside the assert_file block (the expect(content).to include('layout "react_on_rails_default"') call) with a regex match that allows single or double quotes and optional spacing, e.g. use expect(content).to match(/layout\s+["']react_on_rails_default["']/) so the test accepts either quote style and flexible whitespace.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@react_on_rails/spec/react_on_rails/support/shared_examples/base_generator_examples.rb`:
- Around line 22-26: The assertion for the controller layout is brittle to quote
style and spacing; replace the literal include check inside the assert_file
block (the expect(content).to include('layout "react_on_rails_default"') call)
with a regex match that allows single or double quotes and optional spacing,
e.g. use expect(content).to match(/layout\s+["']react_on_rails_default["']/) so
the test accepts either quote style and flexible whitespace.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
CHANGELOG.mdreact_on_rails/spec/react_on_rails/support/shared_examples/base_generator_examples.rb
🚧 Files skipped from review as they are similar to previous changes (1)
- CHANGELOG.md
Summary
hello_world.html.erbtoreact_on_rails_default.html.erbHelloWorldController,HelloServerController) to declarelayout "react_on_rails_default"base_generator.rbcomment and file path stringrsc_hello_server_controllershared examplereact_on_rails_pro/spec/execjs-compatible-dummyThe layout's only purpose is to provide empty
javascript_pack_tag/stylesheet_pack_tagcalls for React on Rails auto-registration. It has no connection to the HelloWorld demo — and in RSC-only installs (--rscwithout--redux), no HelloWorld controller is generated at all, making the name actively confusing.Only affects newly generated apps. Existing apps are unchanged.
Notes
dummy-for-generators/andgen-examples/are gitignored (generated at test/rake time) — they will automatically produce the new name from the updated generator templatesTest Plan
assert_file "app/views/layouts/react_on_rails_default.html.erb"passes in all four RSC contextslayout "react_on_rails_default"Summary by CodeRabbit
Bug Fixes
Changed