Fix default layout handling for render component#1418
Conversation
PR Review: Fix default layout handling for render componentThis is a well-scoped fix for #1356. The logic is correct and the test coverage is solid. A few observations below. Core logic (
|
Code ReviewOverall, this is a clean, well-scoped fix for the Rails 8 layout regression. The approach is correct and the test coverage is solid. A few notes below.
|
| Area | Status |
|---|---|
| Bug fix correctness | ✅ Correct — key? guard handles layout: false properly |
| Unit test coverage | ✅ Good — all three option combinations tested |
| Integration test coverage | ✅ Good — could add named layout case |
| Assertion precision | assert_equal over truthiness checks |
| Changelog format | |
| Security / performance | ✅ No concerns |
The fix is sound and ready to merge once the minor items above are addressed (or consciously left as-is).
|
@G-Rath please take a look. :-) |
Code ReviewOverall: Clean, targeted fix with good test coverage. Approachable for merge with one minor note. What the PR DoesRails 8 changed the render pipeline so that the Code Quality
The extraction into def self.component_render_options(options, html)
render_options = options.merge(inline: html)
return render_options if render_options.key?(:layout)
render_options.merge(layout: true)
end
Minor: Visibility inconsistency. The other two helper class methods (
Neither is a blocker — just worth a conscious decision. Test Coverage
One small observation: Potential Edge Case
Security / PerformanceNo concerns. CHANGELOGEntry is accurate and well-placed. Summary: The fix is correct and minimal. The test suite is thorough. Addressing the |
Code ReviewSummary: Correct, minimal fix for the Rails 8 layout regression. Good to merge with the one minor note below. CorrectnessThe fix is sound.
The One note: visibility inconsistency
TestsBoth test layers are solid:
CHANGELOGFormat and placement are consistent with the rest of the file. ✅ Overall: The change is correct, well-tested, and low-risk. Ready to merge once the |
Summary
render component:when no explicitlayout:option is passedlayout: falserender :component#1356Closes #1356.
Testing
mise exec ruby@3.2.9 -- env BUNDLE_PATH=/Users/justin/codex/react-rails/repo/vendor/bundle bundle exec ruby -Itest test/react/rails/railtie_test.rbmise exec ruby@3.2.9 -- env BUNDLE_PATH=/Users/justin/codex/react-rails/repo/vendor/bundle bundle exec ruby -Itest test/react/rails/component_renderer_test.rbmise exec ruby@3.2.9 -- env BUNDLE_GEMFILE=/Users/justin/codex/react-rails/issue-1356/LintingGemfile BUNDLE_PATH=/Users/justin/codex/react-rails/issue-1356/vendor/bundle bundle exec rubocop lib/react/rails/railtie.rb test/react/rails/railtie_test.rb test/react/rails/component_renderer_test.rb