-
-
Notifications
You must be signed in to change notification settings - Fork 638
Simplify configuration files to improve usability #2011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
After PR #1993 introduced sensible defaults for advanced options like generated_component_packs_loading_strategy (auto-configured based on Pro license), we can significantly simplify generated configuration files and documentation to make React on Rails easier to use. Changes: **Generator Template Simplification:** - Reduced react_on_rails.rb.tt from 67 to 42 lines - Removed redundant explanations for options with good defaults - Added clear pointer to docs for advanced configuration - Kept only essential options in generated files - Commented out file-system component registry (optional feature) **Documentation Restructuring:** - Added "Quick Start" section showing minimal config - Reorganized into "Essential" vs "Advanced" configuration - Documented which options auto-configure based on Pro license - Added clear defaults and recommendations for each option - Improved searchability with structured sections - Added deprecation section for immediate_hydration **Essential Configuration (in generated files):** - server_bundle_js_file - Required for SSR - build_test_command - Used for testing - components_subdirectory - Optional file-based registry - auto_load_bundle - Optional auto-loading **Advanced Configuration (docs only, sensible defaults):** - generated_component_packs_loading_strategy (auto: :async for Pro, :defer for non-Pro) - server_bundle_output_path (default: "ssr-generated") - enforce_private_server_bundles (default: false) - All rendering pool, debugging, and customization options **Dummy App Updates:** - Updated all dummy app configs with clear comments - Separated essential from test-specific configuration - Maintained same functionality with better organization Benefits: - New users see only 2-3 required config options - Clear path from simple to advanced configuration - Reduced cognitive load and decision fatigue - Better reflects PR #1993 auto-configuration improvements - Easier to understand what needs customization Closes: Follow-up to PR #1993 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Rate limit exceeded@justin808 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 21 minutes and 55 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (5)
WalkthroughThis PR comprehensively documents and refactors the React on Rails configuration ecosystem. It adds new documentation files for deprecated/removed configuration options and Pro-specific settings, completely rewrites the main configuration guide with expanded categorization and examples, simplifies the base generator template, and updates multiple dummy application initializers with clearer Essential/Advanced configuration sections and new feature toggles. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
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 |
Code Review: Simplify Configuration Files to Improve UsabilityThank you for this excellent PR! This is a significant improvement to the developer experience. I've reviewed the changes and have the following feedback: ✅ Strengths1. Excellent UX Improvement
2. Documentation Quality
3. Code Quality
4. Alignment with Best Practices
💡 Suggestions1. Minor Documentation EnhancementIn the Quick Start section ( ReactOnRails.configure do |config|
# Server rendering bundle (set to "" if not using SSR)
config.server_bundle_js_file = "server-bundle.js"
# Build assets during test runs
config.build_test_command = "RAILS_ENV=test bin/shakapacker"
endThis helps users understand why they're setting these options without needing to scroll down. 2. Consider Adding a "When to Customize" SectionFor the advanced options, it might be helpful to have a brief callout like: ## When to Explore Advanced Configuration
Most applications won't need advanced configuration, but consider reviewing these options if:
- You need enhanced security (private server bundles)
- You're optimizing load performance (custom loading strategies)
- You're using React Server Components (Pro)
- You need custom rendering behavior (extensions)3. Generator Template: Comment ClarityIn The comment "Set to "" if you're not using server rendering" could be slightly clearer: # Set to "" if NOT using server-side rendering (prerender: true)This explicitly connects it to the 4. Potential Typo CheckIn 🔍 Testing Considerations✅ What's Good:
💭 Verification Checklist:
🛡️ Security & PerformanceNo concerns identified:
📝 Code-Specific Observations
|
Code Review - PR #2011: Simplify configuration files to improve usabilityThis PR successfully achieves its goal of reducing configuration complexity while maintaining functionality. The changes are well-structured and align with the project's usability improvement objectives from PR #1993. ✅ Strengths1. Excellent Documentation Structure
2. Simplified Generator Template
3. Consistent Dummy App Updates
4. Backward Compatible
🔍 Code Quality ObservationsTemplate File (react_on_rails.rb.tt):
Documentation (configuration.md):
🔒 Security Improvements ✅
🧪 Test Coverage ✅From PR description all tests pass:
No additional test coverage needed for documentation/template improvements. 📋 RecommendationsRequired Before Merge:
Suggested Improvements (Optional):
🎉 SummaryThis is a high-quality PR that meaningfully improves UX for new React on Rails users. The 37% reduction in generated config file size, combined with improved documentation structure, will significantly reduce onboarding friction. Ratings:
Recommendation: ✅ Approve after adding CHANGELOG entry Great work on this usability improvement! This will make React on Rails much more approachable for new users while maintaining full power for advanced use cases. |
- Reorganize Essential Configuration to focus on recommended options only - Move file-based component registry docs to existing sibling document - Clarify build_test_command should prefer shakapacker.yml compile setting - Add guidance that prerender is typically set per-component - Note logging_on_server behavior with Pro Node Renderer - Move rendering extensions to new Common Configuration section - Clarify same_bundle_for_client_and_server should almost never be true - Note server_bundle_output_path default doesn't need manual setting - Split Pro features into configuration-pro.md - Split deprecated options into configuration-deprecated.md - Simplify generator template to match documentation changes 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Review: Simplify Configuration FilesI've reviewed PR #2011 and have overall positive feedback with some recommendations for consideration. ✅ StrengthsCode Quality & Best Practices
Documentation Excellence
User Experience
🔍 Observations & Recommendations1. Documentation ConsistencyIn # Test Configuration
# Alternatively, set `compile: true` in config/shakapacker.yml for test env
config.build_test_command = "RAILS_ENV=test bin/shakapacker"Status: ✅ Already done in the template - excellent! 2. Server Bundle DocumentationThe generator template comment "Set to "" if you're not using server rendering" is clear, but consider emphasizing this is for SSR-only (not RSC): # Configure server bundle for server-side rendering with `prerender: true`
# Set to "" if you're not using server rendering
# Note: React Server Components use separate configuration (Pro feature)3. Deprecation Migration PathThe **Status:** ⚠️ DEPRECATED in v16.0, to be removed in v18.0This helps users understand urgency of migration. 4. File OrganizationThe new
5. Generator Template Best PracticeThe template shows
# Test Configuration (Optional)
# Recommended: set `compile: true` in config/shakapacker.yml for test env
# Use build_test_command only if you need custom build logic
# config.build_test_command = "RAILS_ENV=test bin/shakapacker"🐛 Potential IssuesMinor: Documentation LinksIn See the [16.0.0 Release Notes](../upgrading/release-notes/16.0.0.md) for more details.Verify this path exists or will exist when this PR merges. 🔒 Security
⚡ Performance
🧪 Test CoverageBased on the PR description:
Recommendation: Consider adding a test that validates the generator template produces valid configuration (if not already covered). 📝 Code Style
🎯 Overall AssessmentThis is an excellent PR that significantly improves React on Rails usability. The simplification is well-executed, the documentation restructuring is thoughtful, and the changes build nicely on the auto-configuration work from PR #1993. Summary
The recommendations above are mostly minor enhancements that could be addressed in follow-up PRs if desired. Great work! 🎉 Review generated by Claude Code with human oversight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
spec/dummy/config/initializers/react_on_rails.rb (1)
7-26: Consider simplifying the RenderingPropsExtension.The
RenderingPropsExtension.adjust_props_for_client_side_hydrationmethod acceptscomponent_namebut doesn't use it. According to line 23, it modifies props conditionally based on component name, but the actual implementation just returns props unchanged.If the current behavior is intentional for testing, consider adding a comment. Otherwise, you might want to align it with the other dummy app at
react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb(lines 21-27), which has a working implementation that strips:ssrOnlyProps.docs/api-reference/configuration.md (1)
107-141: Enhance the build_test_command guidance.The documentation for
build_test_commandis good, but the preferred alternative (settingcompile: truein shakapacker.yml) could be emphasized more prominently. Consider moving the "Preferred alternative" section before the command example to guide users toward the better approach first.Apply this structure to emphasize the preferred approach:
### build_test_command **Type:** String **Default:** `""` **Used with:** `ReactOnRails::TestHelper.configure_rspec_to_compile_assets(config)` +**Preferred approach:** Set `compile: true` in `config/shakapacker.yml` for the test environment: + +```yaml +test: + compile: true +``` + +**Alternative (explicit control):** Use this configuration option only if you need to customize the build command: -**Note:** It's generally preferred to set `compile: true` in your `config/shakapacker.yml` for the test environment instead of using this configuration option. Use this option only if you need to customize the build command or want explicit control over test asset compilation. - -The command to run to build webpack assets during test runs: - ```ruby config.build_test_command = "RAILS_ENV=test bin/shakapacker"
-Preferred alternative: Set
compile: trueinconfig/shakapacker.yml:-```yaml
-test:
- compile: true
-```</blockquote></details> </blockquote></details> <details> <summary>📜 Review details</summary> **Configuration used**: CodeRabbit UI **Review profile**: CHILL **Plan**: Pro <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between c1ae439de29074c20f4be60839b2eb7aab33fde5 and 5b07560e05becaede16f695ff01c6b613a601842. </details> <details> <summary>📒 Files selected for processing (7)</summary> * `docs/api-reference/configuration-deprecated.md` (1 hunks) * `docs/api-reference/configuration-pro.md` (1 hunks) * `docs/api-reference/configuration.md` (2 hunks) * `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` (1 hunks) * `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` (3 hunks) * `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` (1 hunks) * `spec/dummy/config/initializers/react_on_rails.rb` (2 hunks) </details> <details> <summary>🧰 Additional context used</summary> <details> <summary>🧠 Learnings (12)</summary> <details> <summary>📓 Common learnings</summary>Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. Thereact_on_rails_pro?method validates licenses and should raise errors early (including during path resolution in methods likeserver_bundle?) to enforce licensing requirements rather than failing later with obscure errors.Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files underapp-react16directories are copied/moved to corresponding/appdirectories during the conversion process (removing the-react16suffix), which affects their relative import paths at runtime.Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntaximport * as style from './file.module.css'rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1781
File: node_package/src/ClientSideRenderer.ts:82-95
Timestamp: 2025-09-15T21:24:48.207Z
Learning: In React on Rails, the force_load feature includes both explicitdata-force-load="true"usage and the ability to hydrate components during the page loading state (document.readyState === 'loading'). Both capabilities require a Pro license, so the condition!railsContext.rorPro && (isComponentForceLoaded || document.readyState === 'loading')correctly gates both scenarios.Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
- Pro version check in
run_stream_inside_fiber- RSC support check during pack generation via
ReactOnRailsPro.configuration.enable_rsc_support- RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The filenode_package/lib/ReactOnRails.full.jsis autogenerated during the build process and should not be present in the repository.Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1745
File: node_package/src/RSCRequestTracker.ts:8-14
Timestamp: 2025-07-08T05:57:29.630Z
Learning: The globalgenerateRSCPayloadfunction in React on Rails Pro (RORP) is provided by the framework during rendering requests, not implemented in application code. Thedeclare globalstatements are used to document the expected interface that RORP will inject at runtime.</details> <details> <summary>📚 Learning: 2025-09-16T08:01:11.146Z</summary>Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntaximport * as style from './file.module.css'rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.**Applied to files:** - `docs/api-reference/configuration.md` - `spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-pro.md` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-deprecated.md` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` - `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` </details> <details> <summary>📚 Learning: 2025-02-12T16:38:06.537Z</summary>Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The filenode_package/lib/ReactOnRails.full.jsis autogenerated during the build process and should not be present in the repository.**Applied to files:** - `docs/api-reference/configuration.md` - `spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-pro.md` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-deprecated.md` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` - `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` </details> <details> <summary>📚 Learning: 2025-02-18T13:08:01.477Z</summary>Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation in React on Rails Pro is handled through a chain of validations:
- Pro version check in
run_stream_inside_fiber- RSC support check during pack generation via
ReactOnRailsPro.configuration.enable_rsc_support- RSC support validation during component registration
This makes additional validation in the helper methods unnecessary.**Applied to files:** - `docs/api-reference/configuration.md` - `spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-pro.md` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` - `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` </details> <details> <summary>📚 Learning: 2025-04-26T21:55:55.874Z</summary>Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files underapp-react16directories are copied/moved to corresponding/appdirectories during the conversion process (removing the-react16suffix), which affects their relative import paths at runtime.**Applied to files:** - `docs/api-reference/configuration.md` - `spec/dummy/config/initializers/react_on_rails.rb` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-deprecated.md` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` - `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` </details> <details> <summary>📚 Learning: 2025-09-15T21:24:48.207Z</summary>Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1781
File: node_package/src/ClientSideRenderer.ts:82-95
Timestamp: 2025-09-15T21:24:48.207Z
Learning: In React on Rails, the force_load feature includes both explicitdata-force-load="true"usage and the ability to hydrate components during the page loading state (document.readyState === 'loading'). Both capabilities require a Pro license, so the condition!railsContext.rorPro && (isComponentForceLoaded || document.readyState === 'loading')correctly gates both scenarios.**Applied to files:** - `docs/api-reference/configuration.md` - `spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-pro.md` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-deprecated.md` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` - `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` </details> <details> <summary>📚 Learning: 2025-10-23T17:22:01.074Z</summary>Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. Thereact_on_rails_pro?method validates licenses and should raise errors early (including during path resolution in methods likeserver_bundle?) to enforce licensing requirements rather than failing later with obscure errors.**Applied to files:** - `docs/api-reference/configuration.md` - `spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-pro.md` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` - `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` </details> <details> <summary>📚 Learning: 2025-07-08T05:57:29.630Z</summary>Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1745
File: node_package/src/RSCRequestTracker.ts:8-14
Timestamp: 2025-07-08T05:57:29.630Z
Learning: The globalgenerateRSCPayloadfunction in React on Rails Pro (RORP) is provided by the framework during rendering requests, not implemented in application code. Thedeclare globalstatements are used to document the expected interface that RORP will inject at runtime.**Applied to files:** - `docs/api-reference/configuration.md` - `spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-pro.md` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-deprecated.md` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` - `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` </details> <details> <summary>📚 Learning: 2025-02-13T16:50:47.848Z</summary>Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/clientStartup.ts:18-21
Timestamp: 2025-02-13T16:50:47.848Z
Learning: In the react_on_rails module, thereactOnRailsPageUnloadedfunction in clientStartup.ts is intentionally kept private as it's only used internally as a callback foronPageUnloaded.**Applied to files:** - `docs/api-reference/configuration.md` - `spec/dummy/config/initializers/react_on_rails.rb` - `docs/api-reference/configuration-pro.md` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` - `lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt` </details> <details> <summary>📚 Learning: 2024-12-12T13:07:09.929Z</summary>Learnt from: alexeyr-ci
Repo: shakacode/react_on_rails PR: 1644
File: node_package/src/ReactOnRailsRSC.ts:87-87
Timestamp: 2024-12-12T13:07:09.929Z
Learning: When handling errors in 'node_package/src/ReactOnRailsRSC.ts', include the error stack in error messages in development and test environments to aid debugging.**Applied to files:** - `spec/dummy/config/initializers/react_on_rails.rb` </details> <details> <summary>📚 Learning: 2024-10-08T20:53:47.076Z</summary>Learnt from: theforestvn88
Repo: shakacode/react_on_rails PR: 1620
File: spec/dummy/client/app/startup/HelloTurboStream.jsx:3-3
Timestamp: 2024-10-08T20:53:47.076Z
Learning: TheRailsContextimport inspec/dummy/client/app/startup/HelloTurboStream.jsxis used later in the project, as clarified by the user theforestvn88.**Applied to files:** - `spec/dummy/config/initializers/react_on_rails.rb` - `react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb` - `react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb` </details> <details> <summary>📚 Learning: 2025-02-18T13:08:01.477Z</summary>Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation is handled in deeper level calls of the React on Rails Pro codebase, so it doesn't need to be validated again in thersc_payload_react_componenthelper method.**Applied to files:** - `docs/api-reference/configuration-pro.md` </details> </details><details> <summary>🧬 Code graph analysis (3)</summary> <details> <summary>spec/dummy/config/initializers/react_on_rails.rb (3)</summary><blockquote> <details> <summary>react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb (1)</summary> * `adjust_props_for_client_side_hydration` (21-27) </details> <details> <summary>lib/react_on_rails/react_component/render_options.rb (3)</summary> * `props` (26-28) * `auto_load_bundle` (74-76) * `random_dom_id` (44-46) </details> <details> <summary>lib/react_on_rails/configuration.rb (1)</summary> * `configure` (6-9) </details> </blockquote></details> <details> <summary>react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb (1)</summary><blockquote> <details> <summary>lib/react_on_rails/react_component/render_options.rb (2)</summary> * `auto_load_bundle` (74-76) * `random_dom_id` (44-46) </details> </blockquote></details> <details> <summary>react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb (1)</summary><blockquote> <details> <summary>lib/react_on_rails/react_component/render_options.rb (1)</summary> * `auto_load_bundle` (74-76) </details> </blockquote></details> </details><details> <summary>🪛 LanguageTool</summary> <details> <summary>docs/api-reference/configuration.md</summary> [style] ~406-~406: To form a complete sentence, be sure to include a subject or ‘there’. Context: ...stances of same component on one page. Can be overridden per-component: ```ruby r... (MISSING_IT_THERE) --- [style] ~502-~502: ‘almost never’ might be wordy. Consider a shorter alternative. Context: ...r = false # default ``` **This should almost never be true.** Almost all apps should use s... (EN_WORDINESS_PREMIUM_ALMOST_NEVER) </details> </details> <details> <summary>🪛 markdownlint-cli2 (0.18.1)</summary> <details> <summary>docs/api-reference/configuration.md</summary> 638-638: Fenced code blocks should have a language specified (MD040, fenced-code-language) </details> </details> </details> <details> <summary>⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)</summary> * GitHub Check: build-dummy-app-webpack-test-bundles * GitHub Check: build-dummy-app-webpack-test-bundles * GitHub Check: lint-js-and-ruby * GitHub Check: claude-review * GitHub Check: markdown-link-check </details> <details> <summary>🔇 Additional comments (10)</summary><blockquote> <details> <summary>react_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb (1)</summary><blockquote> `3-31`: **LGTM! Clean and well-organized configuration.** The ExecJS-compatible dummy app configuration is appropriately streamlined with clear separation between essential and advanced configuration. The use of `bin/webpacker` instead of `bin/shakapacker` is correct for legacy compatibility testing. </blockquote></details> <details> <summary>lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt (1)</summary><blockquote> `3-35`: **LGTM! Generator template successfully simplified.** The template achieves the PR's goal of reducing from 67 to 42 lines while maintaining clarity. The separation between essential configuration (server rendering and tests) and advanced options (with a comprehensive pointer to documentation) provides an excellent developer experience for new users. </blockquote></details> <details> <summary>spec/dummy/config/initializers/react_on_rails.rb (1)</summary><blockquote> `28-52`: **LGTM! Well-organized test configuration.** The test-specific configuration is clearly separated and documented. The explicit settings for `random_dom_id = false` and `generated_component_packs_loading_strategy = :defer` make testing behavior predictable and deterministic. </blockquote></details> <details> <summary>docs/api-reference/configuration-pro.md (1)</summary><blockquote> `1-40`: **LGTM! Clear and focused Pro documentation.** The Pro configuration documentation is well-structured and appropriately minimal, deferring detailed setup instructions to the Pro package docs while providing a clear overview of the key configuration options. The example configuration is valid and helpful. </blockquote></details> <details> <summary>docs/api-reference/configuration-deprecated.md (1)</summary><blockquote> `1-52`: **LGTM! Clear deprecation guidance.** The deprecated configuration documentation provides excellent migration guidance with clear examples of old vs. new patterns. The distinction between "REMOVED" and "DEPRECATED" status is helpful for users upgrading from different versions. </blockquote></details> <details> <summary>react_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb (2)</summary><blockquote> `6-28`: **LGTM! Proper Pro rendering extensions.** The rendering extensions are well-implemented for Pro feature testing. The `RenderingPropsExtension` correctly strips server-only props (`:ssrOnlyProps`) before client-side hydration, which is a good pattern for Pro apps. --- `30-59`: **LGTM! Comprehensive Pro feature testing configuration.** The configuration appropriately tests Pro features like private server bundle enforcement (`enforce_private_server_bundles = true`) with the recommended `ssr-generated` output path. The commented-out section (lines 55-58) correctly explains why those options are disabled when using `test.compile: true` in shakapacker.yml. </blockquote></details> <details> <summary>docs/api-reference/configuration.md (3)</summary><blockquote> `1-81`: **LGTM! Excellent documentation structure.** The introduction and prerequisites section provides a great developer experience with the Quick Start example and clear categorization of Essential vs. Advanced configuration. The emphasis on sensible defaults (line 5: "Most applications only need 2-3 configuration options") aligns perfectly with the PR's goals. --- `152-226`: **LGTM! Clear advanced configuration documentation.** The advanced configuration sections are well-structured with consistent formatting (Type/Default/Auto-configured metadata) and helpful explanations. The emphasis on auto-configuration (e.g., "You typically don't need to set this" on line 166) reinforces the PR's goal of simplifying configuration. --- `540-664`: **LGTM! Comprehensive examples and references.** The complete example, bundle organization guidance, and support resources provide excellent reference material. The directory structure example (lines 638-648) clearly illustrates the recommended separation between private server bundles and public client bundles. </blockquote></details> </blockquote></details> </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
| ``` | ||
| app/ | ||
| ├── ssr-generated/ # Private server bundles (never served to browsers) | ||
| │ ├── server-bundle.js | ||
| │ └── rsc-bundle.js | ||
| └── public/ | ||
| └── webpack/development/ # Public client bundles (web-accessible) | ||
| ├── application.js | ||
| ├── manifest.json | ||
| └── styles.css | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add language identifier to fenced code block.
The fenced code block on line 638 is missing a language identifier, which affects both syntax highlighting and accessibility.
Apply this diff:
-```
+```text
app/
├── ssr-generated/ # Private server bundles (never served to browsers)
│ ├── server-bundle.js🧰 Tools
🪛 markdownlint-cli2 (0.18.1)
638-638: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
docs/api-reference/configuration.md around lines 638 to 648: the fenced code
block is missing a language identifier; update the opening fence from ``` to
```text (and ensure the closing fence remains) so the block begins with ```text
and the content remains unchanged, which will enable proper syntax highlighting
and accessibility.
Address code review suggestions to improve clarity and usability of configuration documentation and generated config files. Key improvements: Documentation clarity: - Remove redundant Quick Start code block, reference Essential Configuration instead - Add clarification that build_test_command is used with TestHelper - Add context for File-Based Component Registry explaining use cases - Add stronger warning to server_bundle_output_path with prominent notice - Add use case guidance for when to override auto-configured settings - Add "When to disable" guidance for replay_console option - Add introductory context for I18n configuration section Generated template improvements: - Clarify build_test_command usage with TestHelper in comments - Emphasize that compile: true in shakapacker.yml is preferred alternative Dummy app improvements: - Add prominent warning to all dummy app configs to prevent cargo-culting - Clearly mark as "TEST CONFIGURATION - Do not copy directly for production" All changes maintain backward compatibility and improve the developer experience by providing clearer guidance on which options need configuration and when to override defaults. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Review: Simplify configuration files to improve usabilityThanks for this PR! This is a great improvement that significantly reduces cognitive load for new users. I've reviewed the code, documentation, and test coverage. Here's my feedback: Strengths1. Excellent Documentation Restructuring
2. Generator Template Simplification
3. Backwards Compatibility
4. Code Quality
Suggestions and Minor Issues1. Documentation: Truncated ContentThe configuration.md file appears to be truncated in the diff. The last section (random_dom_id) is cut off mid-sentence. Recommendation: Verify the full file is complete and not accidentally truncated. 2. Potential Inconsistency in Deprecated Config DocIn configuration-deprecated.md, it says immediate_hydration is REMOVED in v17.0, but configuration_spec.rb (lines 386-496) shows it still exists but logs deprecation warnings. The docs say REMOVED but the implementation suggests DEPRECATED. Please clarify the actual status. 3. Security Note EnhancementThe enforce_private_server_bundles documentation is good, but could emphasize the production recommendation more strongly with an example of environment-specific configuration. 4. Documentation: Pro Feature ClarityIn configuration.md, the generated_component_packs_loading_strategy section could be even clearer about the Pro distinction with the different defaults. Testing ObservationsTest Coverage: Excellent
Missing Test Coverage (Minor)Consider adding tests for:
Best Practices AdherenceCLAUDE.md Guidelines:
Rails/Ruby Best Practices:
Documentation Best Practices:
Impact AssessmentPositive Impacts:
Potential Concerns:
Recommendations for MergeBefore Merging:
Optional Enhancements (can be follow-ups):
Overall AssessmentRating: 5/5 This is an excellent PR that achieves its goal of simplifying React on Rails configuration. The documentation restructuring is thoughtful, the template simplification is meaningful, and there are no breaking changes. The only issues are minor documentation inconsistencies and a potential clarification needed on deprecation status. Recommendation: Approve with minor fixes (primarily the truncation check and deprecation status clarification). Great work on making React on Rails more approachable! |
Code ReviewI've reviewed PR #2011 and overall this is an excellent improvement to the React on Rails configuration experience. The simplification aligns well with modern best practices of providing sensible defaults while maintaining flexibility for advanced users. ✅ Strengths1. Excellent User Experience Improvements
2. Well-Structured Documentation
3. Smart Defaults Strategy
4. Maintains Backward Compatibility
🔍 Areas for Consideration1. Generator Template Configuration (Minor)In Lines 46-53: The generated template now includes config.server_bundle_output_path = "ssr-generated"
config.enforce_private_server_bundles = truePotential issue: This contradicts the PR's goal of simplifying to "essential only" configuration, as these have sensible defaults ( Recommendation: Consider either:
Rationale: The documentation (configuration.md) states these are advanced options with defaults, but the generator makes them look required. 2. File-Based Component Registry (Lines 55-66)The generator template has this section commented out, which is perfect: config.components_subdirectory = "ror_components"
config.auto_load_bundle = trueSuggestion: Add a brief comment pointing to the auto-bundling docs for users who might benefit from this feature: # File-Based Component Registry (Optional)
# Automatically generate webpack entries based on file structure
# See: https://github.com/shakacode/react_on_rails/blob/master/docs/core-concepts/auto-bundling-file-system-based-automated-bundle-generation.md
# config.components_subdirectory = "ror_components"
# config.auto_load_bundle = true3. Documentation Consistency (Minor)In Line ~52 (build_test_command section): The docs say:
But the generator template (line 28) sets Recommendation: Either:
4. Security Configuration DefaultsQuestion for consideration: Should Current default is
Suggestion: Consider adding a deprecation warning when 📋 Testing & Quality✅ Checklist items mentioned in PR:
Additional testing recommendations:
🎯 Overall AssessmentThis is a high-quality PR that significantly improves the developer experience for React on Rails. The simplification is well-thought-out and properly documented. Rating: Approve with minor suggestions The concerns raised are minor refinements that don't block merging - they're suggestions for making an already-good PR even better. 📚 Additional Documentation Suggestions
Great work on this PR! The focus on developer experience through sensible defaults is exactly the right direction. 🚀 cc: @justin808 |
Summary
After PR #1993 introduced sensible defaults for advanced options like
generated_component_packs_loading_strategy(auto-configured based on Pro license), we can significantly simplify generated configuration files and documentation to make React on Rails easier to use.This PR reduces configuration complexity while maintaining full functionality through smart defaults.
Key Improvements
Generator Template Simplification
Documentation Restructuring
immediate_hydrationConfiguration Categories
Essential Configuration (in generated files):
server_bundle_js_file- Required for SSRbuild_test_command- Used for testingcomponents_subdirectory- Optional file-based registryauto_load_bundle- Optional auto-loadingAdvanced Configuration (docs only, sensible defaults):
generated_component_packs_loading_strategy- Auto::asyncfor Pro,:deferfor non-Proserver_bundle_output_path- Default:"ssr-generated"enforce_private_server_bundles- Default:falseDummy App Updates
Example: Before and After
Before (67 lines with lots of inline documentation):
After (42 lines, clearer structure):
Benefits
Testing
Files Changed
lib/generators/react_on_rails/templates/base/base/config/initializers/react_on_rails.rb.tt- Simplified generator templatedocs/api-reference/configuration.md- Restructured documentation with Essential/Advanced sectionsspec/dummy/config/initializers/react_on_rails.rb- Updated with better organizationreact_on_rails_pro/spec/dummy/config/initializers/react_on_rails.rb- Updated Pro dummyreact_on_rails_pro/spec/execjs-compatible-dummy/config/initializers/react_on_rails.rb- Updated execjs dummyRelated
🤖 Generated with Claude Code
This change is
Summary by CodeRabbit