Releases: shakacode/react_on_rails
v16.6.0
Removed
- Removed
immediate_hydrationconfiguration and parameter: Theimmediate_hydrationconfig option, helper parameter,data-immediate-hydrationHTML attribute, andredux_storeimmediate_hydration:keyword argument have been completely removed. Immediate hydration is now always enabled for React on Rails Pro users and disabled for non-Pro users, with no per-component override. Remove anyimmediate_hydrationreferences from your initializer and helper calls. Passingimmediate_hydration:toreact_component/react_component_hashis now ignored, and passing it tostream_react_componentlogs a warning. This change also fixes HTML attribute escaping for redux store names to prevent attribute injection from unsafe store keys. Closes Issue 2142.
PR 2834 by
justin808.
Added
- [Pro] Auto-resolve renderer password from ENV:
setup_renderer_passwordnow falls back toENV["RENDERER_PASSWORD"]when neitherconfig.renderer_passwordnor a URL-embedded password is set, aligning Rails-side behavior with the Node Renderer defaults. Blank values (nilor"") are treated identically and fall through the full resolution chain: config → URL → ENV. PR 2921 by justin808. - Interactive mode prompt for
create-react-on-rails-app: Runningnpx create-react-on-rails-appwithout--proor--rscnow shows an interactive prompt to choose between Standard, Pro, and RSC modes (default: RSC recommended). Explicit flags skip the prompt, and non-interactive environments fall back to standard mode automatically. PR 3063 by justin808. - [Pro] Configurable HTTP keep-alive timeout for node renderer connections: Added
renderer_http_keep_alive_timeoutconfiguration option (default: 30s) to control how long idle persistent HTTP/2 connections to the node renderer are kept alive, preventing SSR failures from stale connections. PR 3069 by justin808. - [Pro]
react_on_rails:pronow automates Pro and RSC Pro upgrades: Added first-class--rsc-proinstall mode, automaticreact_on_rails->react_on_rails_proGemfile and package swaps, and frontend import rewrites to streamline existing app upgrades. PR 2822 by justin808.
Improved
- [Pro] Clearer node renderer request context in exception messages: Exception formatting now uses a generic
Request:label instead of render-specific wording, so/upload-assetsfailures and other non-render paths report the actual request context more clearly. PR 2877 by AbanoubGhadban. - [Pro] Cleaner node renderer diagnostic output: Invalid render-request diagnostics no longer redundantly list
renderingRequestin thebodyKeysoutput since it is already reported via theReceived type:line, andrenderer_http_keep_alive_timeoutdocumentation now recommends setting it shorter than the node renderer's server-side idle timeout. PR 3086 by justin808. - Doctor enforces strict version constraints:
react_on_rails:doctornow escalates non-exact gem and npm version specs (^,~,>=) from warnings to errors, matching the runtime VersionChecker behavior. Wildcard checks now also cover Pro packages (react-on-rails-pro,react_on_rails_pro). PR 3070 by justin808. - Error messages recommend doctor: Runtime version-check crashes, configuration validation errors, and autobundling errors now suggest running
bundle exec rake react_on_rails:doctorfor diagnostics andbundle exec rake react_on_rails:sync_versions WRITE=trueto fix version mismatches. PR 3070 by justin808. sync_versionshandles range specs: Version ranges like^16.5.0,~16.5.0, and>=16.5.0are now parsed and rewritten to the exact expected version instead of being skipped as unsupported. WhenFIX=trueis set, doctor auto-runssync_versionsto fix detected mismatches. PR 3070 by justin808.- [Pro] Improved node renderer error messages for malformed render requests: Added early validation for missing or invalid
renderingRequestpayloads on the render endpoint, returning actionable 400 messages that include received type, body keys, and likely causes (truncation, malformed multipart, content-length mismatch). PR 3068 by justin808. react_on_rails:doctornow prefers runtime configuration: Doctor now reads loadedReactOnRails.configurationvalues before falling back to initializer parsing, improving diagnostics for customized SSR and NodeRenderer setups. PR 2823 by justin808.- Fresh app onboarding for
create-react-on-rails-app: New apps now land on a generated root page with links to the local demos, docs, OSS vs Pro guidance, the Pro quick start, and the marketplace RSC demo.bin/devopens that page on first boot,--rscscaffolds the same fresh-app experience, and the generated app records step-by-step educational git commits for each scaffold phase. PR 2849 by justin808.
Fixed
- Pin third-party npm dependency versions in generator: All third-party npm dependencies installed by the
react_on_rails:installgenerator andbin/switch-bundlerare now pinned to^major.0.0version ranges, preventing peer dependency conflicts from uncontrolled major version bumps. Fixes CI breakage caused by@rspack/plugin-react-refresh@2.0.0requiring@rspack/core@^2.0.0-0while@rspack/corelatest was still1.7.11. SWC dependency pins match Shakapacker's own version constraints. Closes Issue 3082. PR 3083 by ihabadham. - [Pro] Fixed TanStack Router SSR hydration mismatches in the async path: Client hydration now restores server match data before first render, uses
RouterProviderdirectly to match the server-rendered tree, and stops the post-hydration load when a customrouter.options.hydratecallback fails instead of continuing with partially hydrated client state. PR 2932 by justin808. - [Pro] Fixed infinite fork loop when node renderer worker fails to bind port: When a worker failed during
app.listen()(e.g.,EADDRINUSE), the master previously reforked unconditionally, causing an infinite fork/crash loop that consumed CPU and filled logs. Workers now send aWORKER_STARTUP_FAILUREIPC message to the master before exiting; the master sets an abort flag and exits with a clear error message instead of reforking. Scheduled restarts and runtime crashes continue to refork as before. PR 2881 by justin808. - [Pro] Fixed Pro generator multiline and template-literal rewrites: The Pro install generator now correctly handles multiline non-parenthesized
gem "react_on_rails"declarations while preserving trailing options, and correctly rewrites module specifiers around template literals by preserving escaped sequences and detecting multiline template-literal starts after a closed inline template. PR 2918 by justin808. - [Pro] Fixed SSR failures from stale persistent HTTP/2 connections to the node renderer: When idle connections became stale (closed by the node renderer but still considered active by the Ruby side), render requests could be truncated mid-flight, producing confusing
FST_ERR_CTP_INVALID_CONTENT_LENGTHand "INVALID NIL or NULL result for rendering" errors. The newrenderer_http_keep_alive_timeoutconfig (default: 30s) prevents this by closing idle connections before they go stale. Content-Length mismatches now produce specific diagnostic messages instead of generic errors, and sensitive field names are filtered from diagnostic output. Fixes Issue 3071. PR 3069 by justin808. - Legacy Shakapacker migrations are more resilient:
react_on_rails:installnow falls back cleanly when thepackage_jsongem is unavailable, installs only missing JS packages through the detected package manager, and auto-switches legacy JSX-in-.jsapps to Babel when needed. PR 2901 by justin808. - New-app root-route generation is more robust: Generator root-route detection is now centralized, duplicate route insertion is avoided, and home-page generation warns instead of failing when
config/routes.rbis missing or unexpected. PR 2891 by justin808. - **`...
v16.6.0.rc.1
Removed
- Removed
immediate_hydrationconfiguration and parameter: Theimmediate_hydrationconfig option, helper parameter,data-immediate-hydrationHTML attribute, andredux_storeimmediate_hydration:keyword argument have been completely removed. Immediate hydration is now always enabled for React on Rails Pro users and disabled for non-Pro users, with no per-component override. Remove anyimmediate_hydrationreferences from your initializer and helper calls. Passingimmediate_hydration:toreact_component/react_component_hashis now ignored, and passing it tostream_react_componentlogs a warning. This change also fixes HTML attribute escaping for redux store names to prevent attribute injection from unsafe store keys. Closes Issue 2142.
PR 2834 by
justin808.
Added
- [Pro] Auto-resolve renderer password from ENV:
setup_renderer_passwordnow falls back toENV["RENDERER_PASSWORD"]when neitherconfig.renderer_passwordnor a URL-embedded password is set, aligning Rails-side behavior with the Node Renderer defaults. Blank values (nilor"") are treated identically and fall through the full resolution chain: config → URL → ENV. PR 2921 by justin808. - Interactive mode prompt for
create-react-on-rails-app: Runningnpx create-react-on-rails-appwithout--proor--rscnow shows an interactive prompt to choose between Standard, Pro, and RSC modes (default: RSC recommended). Explicit flags skip the prompt, and non-interactive environments fall back to standard mode automatically. PR 3063 by justin808. - [Pro] Configurable HTTP keep-alive timeout for node renderer connections: Added
renderer_http_keep_alive_timeoutconfiguration option (default: 30s) to control how long idle persistent HTTP/2 connections to the node renderer are kept alive, preventing SSR failures from stale connections. PR 3069 by justin808. - [Pro]
react_on_rails:pronow automates Pro and RSC Pro upgrades: Added first-class--rsc-proinstall mode, automaticreact_on_rails->react_on_rails_proGemfile and package swaps, and frontend import rewrites to streamline existing app upgrades. PR 2822 by justin808.
Improved
- Doctor enforces strict version constraints:
react_on_rails:doctornow escalates non-exact gem and npm version specs (^,~,>=) from warnings to errors, matching the runtime VersionChecker behavior. Wildcard checks now also cover Pro packages (react-on-rails-pro,react_on_rails_pro). PR 3070 by justin808. - Error messages recommend doctor: Runtime version-check crashes, configuration validation errors, and autobundling errors now suggest running
bundle exec rake react_on_rails:doctorfor diagnostics andbundle exec rake react_on_rails:sync_versions WRITE=trueto fix version mismatches. PR 3070 by justin808. sync_versionshandles range specs: Version ranges like^16.5.0,~16.5.0, and>=16.5.0are now parsed and rewritten to the exact expected version instead of being skipped as unsupported. WhenFIX=trueis set, doctor auto-runssync_versionsto fix detected mismatches. PR 3070 by justin808.- [Pro] Improved node renderer error messages for malformed render requests: Added early validation for missing or invalid
renderingRequestpayloads on the render endpoint, returning actionable 400 messages that include received type, body keys, and likely causes (truncation, malformed multipart, content-length mismatch). PR 3068 by justin808. react_on_rails:doctornow prefers runtime configuration: Doctor now reads loadedReactOnRails.configurationvalues before falling back to initializer parsing, improving diagnostics for customized SSR and NodeRenderer setups. PR 2823 by justin808.- Fresh app onboarding for
create-react-on-rails-app: New apps now land on a generated root page with links to the local demos, docs, OSS vs Pro guidance, the Pro quick start, and the marketplace RSC demo.bin/devopens that page on first boot,--rscscaffolds the same fresh-app experience, and the generated app records step-by-step educational git commits for each scaffold phase. PR 2849 by justin808.
Fixed
- [Pro] Fixed TanStack Router SSR hydration mismatches in the async path: Client hydration now restores server match data before first render, uses
RouterProviderdirectly to match the server-rendered tree, and stops the post-hydration load when a customrouter.options.hydratecallback fails instead of continuing with partially hydrated client state. PR 2932 by justin808. - [Pro] Fixed infinite fork loop when node renderer worker fails to bind port: When a worker failed during
app.listen()(e.g.,EADDRINUSE), the master previously reforked unconditionally, causing an infinite fork/crash loop that consumed CPU and filled logs. Workers now send aWORKER_STARTUP_FAILUREIPC message to the master before exiting; the master sets an abort flag and exits with a clear error message instead of reforking. Scheduled restarts and runtime crashes continue to refork as before. PR 2881 by justin808. - [Pro] Fixed Pro generator multiline and template-literal rewrites: The Pro install generator now correctly handles multiline non-parenthesized
gem "react_on_rails"declarations while preserving trailing options, and correctly rewrites module specifiers around template literals by preserving escaped sequences and detecting multiline template-literal starts after a closed inline template. PR 2918 by justin808. - [Pro] Fixed SSR failures from stale persistent HTTP/2 connections to the node renderer: When idle connections became stale (closed by the node renderer but still considered active by the Ruby side), render requests could be truncated mid-flight, producing confusing
FST_ERR_CTP_INVALID_CONTENT_LENGTHand "INVALID NIL or NULL result for rendering" errors. The newrenderer_http_keep_alive_timeoutconfig (default: 30s) prevents this by closing idle connections before they go stale. Content-Length mismatches now produce specific diagnostic messages instead of generic errors, and sensitive field names are filtered from diagnostic output. Fixes Issue 3071. PR 3069 by justin808. - Legacy Shakapacker migrations are more resilient:
react_on_rails:installnow falls back cleanly when thepackage_jsongem is unavailable, installs only missing JS packages through the detected package manager, and auto-switches legacy JSX-in-.jsapps to Babel when needed. PR 2901 by justin808. - New-app root-route generation is more robust: Generator root-route detection is now centralized, duplicate route insertion is avoided, and home-page generation warns instead of failing when
config/routes.rbis missing or unexpected. PR 2891 by justin808. bin/devnow exits quietly on Ctrl-C: The process manager and generated Shakapacker watcher wrapper now treat interrupt-driven shutdown as a clean exit, avoiding Ruby backtraces during local development. PR 2652 by justin808.bin/devbrowser auto-open now waits for route readiness:--open-browserand--open-browser-oncenow poll the target app route and open the browser only after receiving a success or redirect response, reducing premature opens during boot. PR 2885 by justin808.
v16.6.0.rc.0
Added
- [Pro]
react_on_rails:pronow automates Pro and RSC Pro upgrades: Added first-class--rsc-proinstall mode, automaticreact_on_rails->react_on_rails_proGemfile and package swaps, and frontend import rewrites to streamline existing app upgrades. PR 2822 by justin808.
Improved
react_on_rails:doctornow prefers runtime configuration: Doctor now reads loadedReactOnRails.configurationvalues before falling back to initializer parsing, improving diagnostics for customized SSR and NodeRenderer setups. PR 2823 by justin808.- Fresh app onboarding for
create-react-on-rails-app: New apps now land on a generated root page with links to the local demos, docs, OSS vs Pro guidance, the Pro quick start, and the marketplace RSC demo.bin/devopens that page on first boot,--rscscaffolds the same fresh-app experience, and the generated app records step-by-step educational git commits for each scaffold phase. PR 2849 by justin808.
Fixed
- Legacy Shakapacker migrations are more resilient:
react_on_rails:installnow falls back cleanly when thepackage_jsongem is unavailable, installs only missing JS packages through the detected package manager, and auto-switches legacy JSX-in-.jsapps to Babel when needed. PR 2901 by justin808. - New-app root-route generation is more robust: Generator root-route detection is now centralized, duplicate route insertion is avoided, and home-page generation warns instead of failing when
config/routes.rbis missing or unexpected. PR 2891 by justin808. bin/devnow exits quietly on Ctrl-C: The process manager and generated Shakapacker watcher wrapper now treat interrupt-driven shutdown as a clean exit, avoiding Ruby backtraces during local development. PR 2652 by justin808.bin/devbrowser auto-open now waits for route readiness:--open-browserand--open-browser-oncenow poll the target app route and open the browser only after receiving a success or redirect response, reducing premature opens during boot. PR 2885 by justin808.
v16.5.1
Fixed
- [Pro] Fixed missing rake tasks in published gem: The Pro gemspec excluded
lib/tasks/from packaged files, so allreact_on_rails_pro:*rake tasks (verify_license,pre_stage_bundle_for_node_renderer,copy_assets_to_remote_vm_renderer,process_v8_logs) were unavailable after gem install. PR 2872 by justin808. - [Pro] Fixed bundle duplication in remote node renderer asset uploads: When RSC support is enabled, running
rake react_on_rails_pro:copy_assets_to_remote_vm_rendererno longer duplicates bundle JS files across bundle directories. Previously, both the server bundle and RSC bundle were copied into every target directory; now each bundle is placed only in its own directory while shared assets (manifests, stats) are correctly distributed to all. PR 2768 by AbanoubGhadban. Fixes Issue 2766.
v16.4.0
Fixed
- Install generator now handles TypeScript and rspack bundler configs correctly: Projects using Shakapacker 9.4+ with TypeScript configs (
.ts) were incorrectly prompted to confirm config replacement duringrails generate react_on_rails:install, because the installer didn't recognize the ESM-style stock configs. The installer andreact_on_rails:doctornow detect all config variants (webpack/rspack, JS/TS), use the correct replacement template for each, and show accurate bundler-specific diagnostic messages. PR 2567 by AbanoubGhadban. - Show incomplete install message after Shakapacker failure: The
react_on_rails:installgenerator now tracks when automatic Shakapacker setup fails and emits an explicit "installation incomplete" warning with manual recovery steps, instead of the misleading "Successfully Installed" banner. PR 2613 by justin808. Fixes Issue 2600. - Ruby 3.4 compatibility for heredocs: Replaced legacy
strip_heredocusage with native squiggly heredocs (<<~) and removed redundant chaining where indentation is already normalized by Ruby. PR 2599 by justin808. - Fix install generator load path for
ReactOnRails::GitUtils: Added an explicitrequire "react_on_rails/git_utils"so generator execution does not rely on broader app boot side effects for this constant to be available. PR 2599 by justin808. server_render_jsnow handles non-Error throws safely: Defensive error serialization now supports thrown primitives andnullvalues without raising secondaryTypeErrorexceptions while building SSR error payloads. PR 2599 by justin808.- Clean stale webpack config on
--rspackinstall: Runningrails g react_on_rails:install --rspacknow removes leftoverconfig/webpack/files when switching from webpack to rspack, preventing Shakapacker deprecation warnings. Only known stock/generated webpack configs are removed; custom files are preserved with a warning. PR 2597 by justin808. Fixes Issue 2549. - Fixed
bin/setupfailing on pnpm workspace member directories:bin/setupnow checks for the presence ofpnpm-lock.yamlbefore runningpnpm install --frozen-lockfile, preventing failures in workspace member directories (e.g.,spec/dummy) where dependencies are managed by the workspace root. PR 2477 by justin808. - CSS module SSR fixes for rspack: Fixed CSS module class name divergence between client and server bundles when using rspack. Server webpack config now filters rspack's
cssExtractLoaderin addition tomini-css-extract-plugin, uses spread syntax to preserve existing CSS module options when settingexportOnlyLocals: true, and adds null guards against undefined entries inrule.usearrays. Note:exportOnlyLocals: trueis no longer applied whencssLoader.options.modulesis falsy (disabled), which is the correct behavior but a change from prior versions. PR 2489 by justin808. - Fixed
private_output_pathnot configured on fresh Shakapacker installs: When runningrails g react_on_rails:installwithout pre-existing Shakapacker configuration,private_output_path: ssr-generatedwas left commented out in the generatedconfig/shakapacker.yml. The generator now detects whether Shakapacker was just installed and passes ashakapacker_just_installedflag toBaseGenerator, which usesforce: truewhen copying the config template to ensure the RoR version replaces Shakapacker's default. PR 2411 by ihabadham. - Install generator
--pretendnow behaves as a safe dry run:react_on_rails:installpreviously executed real Shakapacker setup commands (bundle add,bundle install, andrails shakapacker:install) and could crash onFile.chmodbecause Thor pretend mode does not create files.--pretendnow skips automatic Shakapacker installation and raw chmod calls so dry-run previews complete without side effects. PR 2536 by justin808. - Generator test defaults now consistently use
build_test_command+ TestHelper, with Minitest support: Fresh installs now enableconfig.build_test_commandand wire React on Rails TestHelper for RSpec and Minitest, while generatedconfig/shakapacker.ymlsets testcompile: falseto avoid mixed compilation strategies by default. Doctor now validates helper wiring per framework (including mixed RSpec+Minitest apps), detects separate vs shared test/development output-path workflows, and supportsFIX=trueauto-fixes for the recommended setup path. Addedbin/dev test-watchwithauto|full|client-onlymodes so test watching is easier to run consistently.bin/dev helpand testing docs now explicitly document both the recommended separate-output workflow and the advanced static-only shared-output workflow, including migration from manual watcher commands. PR 2513 by justin808. bin/devhook script path resolution without Rails.root: Fixedresolve_hook_script_pathfailing in early startup (before Rails is initialized) by adding aproject_roothelper that resolves the project root viaBUNDLE_GEMFILEdirname orDir.pwdwhenRails.rootis unavailable. PR 2568 by ihabadham. Fixes Issue 2438.- Rspack generator config path: Fixed
--rspackgenerator placing config files underconfig/webpack/instead ofconfig/rspack/, causing Shakapacker deprecation warnings. All config file destinations are now dynamically remapped based on the active bundler, andusing_rspack?auto-detects rspack projects for standalone generators (react_on_rails:rsc,react_on_rails:pro). PR 2417 by justin808. - Precompile hook load-based execution path: Fixed the precompile hook not executing its tasks when invoked via
load(as used bybin/dev) instead of direct script execution. Added a sharedrun_precompile_tasksentry point that works regardless of invocation method. PR 2419 by justin808. Fixes Issue 2195. create-react-on-rails-appvalidation improvements: Tightened CLI validation to enforce Rails 7+ and app-name leading-letter requirements, with clearer error messages for invalid names containing hyphens or underscores. PR 2577 by justin808.- Install
@babel/preset-reactfor non-SWC generator installs: The generator now installs@babel/preset-reactas a dev dependency when the project uses Babel (not SWC) as the transpiler, fixing JSX compilation errors on fresh installs with older Shakapacker defaults. PR 2421 by justin808. - Fix
react_on_rails:doctorfalse positives for Pro/SWC setups: Doctor now recognizesreact-on-rails-pronpm package for presence and version sync checks, skips@babel/preset-reactcheck when SWC is the transpiler, and fixes a nil-safety bug where missing"dependencies"in package.json silently dropped devDependencies from checks. PR 2581 by ihabadham. - Fixed ScoutApm instrumentation depending on Gemfile ordering. ScoutApm instrumentation for
react_component,react_component_hash, andexec_server_render_jswas previously installed at gem load time usingdefined?(ScoutApm)guards, which meant it was silently skipped ifscout_apmappeared afterreact_on_railsin the Gemfile, and produced noisy INFO log messages if it appeared before (since ScoutApm wasn't yet initialized). Moved instrumentation into an initializer that runs afterscout_apm.start, ensuring it works regardless of gem ordering and only after ScoutApm is fully configured. PR 2442 by tonyta. - RSC WebpackLoader with SWC transpiler: Fixed RSC WebpackLoader never being injected when using SWC (Shakapacker's default transpiler). The RSC config only handled array-based
rule.use(Babel) but SWC uses a function-basedrule.use, so'use client'files passed through untransformed into the RSC bundle. Now handles both array and function loader declarations. PR 2476 by AbanoubGhadban. - RSC Generator Layout Wiring: Fixed
MissingEntryErroron fresh RSC installs whereHelloServerControllerfell back to Rails'application.html.erb(which usesjavascript_pack_tag "application"that is not created by the RSC flow). The generator now alw...
v16.4.0.rc.10
Fixed
- Show incomplete install message after Shakapacker failure: The
react_on_rails:installgenerator now tracks when automatic Shakapacker setup fails and emits an explicit "installation incomplete" warning with manual recovery steps, instead of the misleading "Successfully Installed" banner. PR 2613 by justin808. Fixes Issue 2600. - Ruby 3.4 compatibility for heredocs: Replaced legacy
strip_heredocusage with native squiggly heredocs (<<~) and removed redundant chaining where indentation is already normalized by Ruby. PR 2599 by justin808. - Fix install generator load path for
ReactOnRails::GitUtils: Added an explicitrequire "react_on_rails/git_utils"so generator execution does not rely on broader app boot side effects for this constant to be available. PR 2599 by justin808. server_render_jsnow handles non-Error throws safely: Defensive error serialization now supports thrown primitives andnullvalues without raising secondaryTypeErrorexceptions while building SSR error payloads. PR 2599 by justin808.- Clean stale webpack config on
--rspackinstall: Runningrails g react_on_rails:install --rspacknow removes leftoverconfig/webpack/files when switching from webpack to rspack, preventing Shakapacker deprecation warnings. Only known stock/generated webpack configs are removed; custom files are preserved with a warning. PR 2597 by justin808. Fixes Issue 2549. - Fixed
bin/setupfailing on pnpm workspace member directories:bin/setupnow checks for the presence ofpnpm-lock.yamlbefore runningpnpm install --frozen-lockfile, preventing failures in workspace member directories (e.g.,spec/dummy) where dependencies are managed by the workspace root. PR 2477 by justin808. - CSS module SSR fixes for rspack: Fixed CSS module class name divergence between client and server bundles when using rspack. Server webpack config now filters rspack's
cssExtractLoaderin addition tomini-css-extract-plugin, uses spread syntax to preserve existing CSS module options when settingexportOnlyLocals: true, and adds null guards against undefined entries inrule.usearrays. Note:exportOnlyLocals: trueis no longer applied whencssLoader.options.modulesis falsy (disabled), which is the correct behavior but a change from prior versions. PR 2489 by justin808. - Fixed
private_output_pathnot configured on fresh Shakapacker installs: When runningrails g react_on_rails:installwithout pre-existing Shakapacker configuration,private_output_path: ssr-generatedwas left commented out in the generatedconfig/shakapacker.yml. The generator now detects whether Shakapacker was just installed and passes ashakapacker_just_installedflag toBaseGenerator, which usesforce: truewhen copying the config template to ensure the RoR version replaces Shakapacker's default. PR 2411 by ihabadham. - Install generator
--pretendnow behaves as a safe dry run:react_on_rails:installpreviously executed real Shakapacker setup commands (bundle add,bundle install, andrails shakapacker:install) and could crash onFile.chmodbecause Thor pretend mode does not create files.--pretendnow skips automatic Shakapacker installation and raw chmod calls so dry-run previews complete without side effects. PR 2536 by justin808. - Generator test defaults now consistently use
build_test_command+ TestHelper, with Minitest support: Fresh installs now enableconfig.build_test_commandand wire React on Rails TestHelper for RSpec and Minitest, while generatedconfig/shakapacker.ymlsets testcompile: falseto avoid mixed compilation strategies by default. Doctor now validates helper wiring per framework (including mixed RSpec+Minitest apps), detects separate vs shared test/development output-path workflows, and supportsFIX=trueauto-fixes for the recommended setup path. Addedbin/dev test-watchwithauto|full|client-onlymodes so test watching is easier to run consistently.bin/dev helpand testing docs now explicitly document both the recommended separate-output workflow and the advanced static-only shared-output workflow, including migration from manual watcher commands. PR 2513 by justin808. bin/devhook script path resolution without Rails.root: Fixedresolve_hook_script_pathfailing in early startup (before Rails is initialized) by adding aproject_roothelper that resolves the project root viaBUNDLE_GEMFILEdirname orDir.pwdwhenRails.rootis unavailable. PR 2568 by ihabadham. Fixes Issue 2438.- Rspack generator config path: Fixed
--rspackgenerator placing config files underconfig/webpack/instead ofconfig/rspack/, causing Shakapacker deprecation warnings. All config file destinations are now dynamically remapped based on the active bundler, andusing_rspack?auto-detects rspack projects for standalone generators (react_on_rails:rsc,react_on_rails:pro). PR 2417 by justin808. - Precompile hook load-based execution path: Fixed the precompile hook not executing its tasks when invoked via
load(as used bybin/dev) instead of direct script execution. Added a sharedrun_precompile_tasksentry point that works regardless of invocation method. PR 2419 by justin808. Fixes Issue 2195. create-react-on-rails-appvalidation improvements: Tightened CLI validation to enforce Rails 7+ and app-name leading-letter requirements, with clearer error messages for invalid names containing hyphens or underscores. PR 2577 by justin808.- Install
@babel/preset-reactfor non-SWC generator installs: The generator now installs@babel/preset-reactas a dev dependency when the project uses Babel (not SWC) as the transpiler, fixing JSX compilation errors on fresh installs with older Shakapacker defaults. PR 2421 by justin808. - Fix
react_on_rails:doctorfalse positives for Pro/SWC setups: Doctor now recognizesreact-on-rails-pronpm package for presence and version sync checks, skips@babel/preset-reactcheck when SWC is the transpiler, and fixes a nil-safety bug where missing"dependencies"in package.json silently dropped devDependencies from checks. PR 2581 by ihabadham. - Fixed ScoutApm instrumentation depending on Gemfile ordering. ScoutApm instrumentation for
react_component,react_component_hash, andexec_server_render_jswas previously installed at gem load time usingdefined?(ScoutApm)guards, which meant it was silently skipped ifscout_apmappeared afterreact_on_railsin the Gemfile, and produced noisy INFO log messages if it appeared before (since ScoutApm wasn't yet initialized). Moved instrumentation into an initializer that runs afterscout_apm.start, ensuring it works regardless of gem ordering and only after ScoutApm is fully configured. PR 2442 by tonyta. - RSC WebpackLoader with SWC transpiler: Fixed RSC WebpackLoader never being injected when using SWC (Shakapacker's default transpiler). The RSC config only handled array-based
rule.use(Babel) but SWC uses a function-basedrule.use, so'use client'files passed through untransformed into the RSC bundle. Now handles both array and function loader declarations. PR 2476 by AbanoubGhadban. - RSC Generator Layout Wiring: Fixed
MissingEntryErroron fresh RSC installs whereHelloServerControllerfell back to Rails'application.html.erb(which usesjavascript_pack_tag "application"that is not created by the RSC flow). The generator now always copieshello_world.html.erb,HelloServerControllerexplicitly useslayout "hello_world", and post-install output now showsstream_react_componentfor RSC installs. PR 2429 by justin808. - Fixed string values interpolated into generated JS code without proper escaping. All string values (component names, DOM IDs, Redux store names) embedded in server-rendering JavaScript now use
.to_jsoninstead of unescaped single-quoted interpolation, preventing potential JS breakage from special characters. [PR 2440](https://github.com/shakacode...
v16.4.0.rc.9
Improved
- Auto-install
react_on_rails_progem for--rsc/--progenerator flags: Runningrails g react_on_rails:install --rscor--pronow automatically installs thereact_on_rails_progem viabundle addinstead of only printing an error, matching how Shakapacker is handled in the same generator. PR 2439 by justin808. - create-react-on-rails-app validation and test coverage: Tightened app name validation (must start with a letter), added Rails 7.0+ prerequisite validation, and expanded validator/setup test coverage (including
validateAllsuccess path). PR 2571 by justin808.
Fixed
- Fixed
bin/setupfailing on pnpm workspace member directories:bin/setupnow checks for the presence ofpnpm-lock.yamlbefore runningpnpm install --frozen-lockfile, preventing failures in workspace member directories (e.g.,spec/dummy) where dependencies are managed by the workspace root. PR 2477 by justin808.
Changed
- Clarified Pro-installation signaling for immediate hydration warnings: Updated Ruby/TypeScript warning text and related docs to state that
railsContext.rorProindicates Pro gem installation (not license validity), and renamedimmediate_hydration_pro_license_warningtoimmediate_hydration_pro_install_warning(no backward-compatible alias needed since the method had no external callers). PR 2590 by justin808.
Pro
Added
- Startup warning for unsafe compression middleware callbacks: Added a startup guard that detects
Rack::DeflaterorRack::Brotlimiddleware with:ifcallbacks that iterate the response body viabody.each, which can break streaming SSR/RSC and deadlockActionController::Live. The warning includes the middleware source location and remediation guidance. PR 2554 by justin808. - Configurable host binding for Node Renderer Fastify worker: Added a
hostsetting (default:process.env.RENDERER_HOST || 'localhost') to control the bind address for the Pro Node Renderer. Set it to0.0.0.0in containerized environments where external health checks need to reach the renderer. PR 2585 by justin808.
Changes since the last non-beta release.
Added
- Automatic dev asset reuse for tests: When
bin/dev staticis running,bundle exec rspec(and Minitest) now automatically detects and reuses the fresh development assets instead of running a separatebuild_test_command. The TestHelper readsconfig/shakapacker.yml, verifies the dev manifest is static-mode (not HMR) and fresh, then temporarily overrides Shakapacker's test config to point at the dev output. No environment variables or extra commands needed — tests "just work" withbin/dev static. HMR mode (bin/dev) continues to require separate test compilation viabuild_test_commandorbin/dev test-watch. PR 2570 by justin808. - TanStack Router SSR integration (Pro): Added
createTanStackRouterRenderFunctionandserverRenderTanStackAppAsyncviareact-on-rails-pro/tanstack-routerfor TanStack Router SSR with the Pro Node Renderer. Uses TanStack Router's publicrouter.load()API for reliable async SSR. Requiresrendering_returns_promises = truein Pro config. PR 2516 by justin808. create-react-on-rails-app --rscflow: Added--rscsupport tonpx create-react-on-rails-appso a single command can scaffold an RSC-ready app. The CLI now installsreact_on_rails_pro, passes--rsctoreact_on_rails:install, and points users to/hello_serverafter setup. PR 2430 by justin808.- Environment-variable-driven ports in Procfile templates: Procfile templates now use
${PORT:-3000}and${SHAKAPACKER_DEV_SERVER_PORT:-3035}instead of hardcoded ports, enabling multiple worktrees to runbin/devconcurrently without port conflicts. Includes aPortSelectorthat auto-detects free ports when defaults are occupied, plus a generated.env.exampledocumenting manual overrides. PR 2539 by ihabadham. - CSP nonce support for RSC streaming and console replay scripts: Added
cspNoncetorails_contextand threaded nonce values through Pro RSC streaming paths (server-side HTML stream injection and client-side console replay script insertion), with nonce sanitization. PR 2418 by justin808.
Fixed
- CSS module SSR fixes for rspack: Fixed CSS module class name divergence between client and server bundles when using rspack. Server webpack config now filters rspack's
cssExtractLoaderin addition tomini-css-extract-plugin, uses spread syntax to preserve existing CSS module options when settingexportOnlyLocals: true, and adds null guards against undefined entries inrule.usearrays. Note:exportOnlyLocals: trueis no longer applied whencssLoader.options.modulesis falsy (disabled), which is the correct behavior but a change from prior versions. PR 2489 by justin808. - Fixed
private_output_pathnot configured on fresh Shakapacker installs: When runningrails g react_on_rails:installwithout pre-existing Shakapacker configuration,private_output_path: ssr-generatedwas left commented out in the generatedconfig/shakapacker.yml. The generator now detects whether Shakapacker was just installed and passes ashakapacker_just_installedflag toBaseGenerator, which usesforce: truewhen copying the config template to ensure the RoR version replaces Shakapacker's default. PR 2411 by ihabadham. - Install generator
--pretendnow behaves as a safe dry run:react_on_rails:installpreviously executed real Shakapacker setup commands (bundle add,bundle install, andrails shakapacker:install) and could crash onFile.chmodbecause Thor pretend mode does not create files.--pretendnow skips automatic Shakapacker installation and raw chmod calls so dry-run previews complete without side effects. PR 2536 by justin808. - Generator test defaults now consistently use
build_test_command+ TestHelper, with Minitest support: Fresh installs now enableconfig.build_test_commandand wire React on Rails TestHelper for RSpec and Minitest, while generatedconfig/shakapacker.ymlsets testcompile: falseto avoid mixed compilation strategies by default. Doctor now validates helper wiring per framework (including mixed RSpec+Minitest apps), detects separate vs shared test/development output-path workflows, and supportsFIX=trueauto-fixes for the recommended setup path. Addedbin/dev test-watchwithauto|full|client-onlymodes so test watching is easier to run consistently.bin/dev helpand testing docs now explicitly document both the recommended separate-output workflow and the advanced static-only shared-output workflow, including migration from manual watcher commands. PR 2513 by justin808.
Pro
Fixed
- Fix streaming deadlock, exception masking, and cache poisoning on client disconnect: Fixed async streaming bugs where client disconnect could cause deadlocks, mask producer exceptions, or cache partial results. PR 2562 by AbanoubGhadban.
- Handle HTTPX error responses when fetching dev-server bundle/assets for upload: During development startup races,
get_form_body_for_filecould receiveHTTPX::ErrorResponseand still callresponse.body, causing an unexpected crash path. The request layer now raisesReactOnRailsPro::Errorwith HTTPX error details before body access and includes regression tests for local path, HTTP success, and HTTP error cases. PR 2532 by justin808. - Fix streaming SSR hangs and silent error absorption in RSC payload injection: Fixed two related issues: (1) streaming SSR renders hanging forever when errors occur because Node.js
stream.pipe()doesn't propagate errors or closure from source to destination, and (2) errors in the RSC payload injection pipeline being silently absorbed, preventing them from reaching error reporters like Sentry. Introduced a sharedsafePipeutility and used'close'events as reliable termination signals across the streaming pipeline (Node renderer, RSC payload injection, transform streams, and Ruby async task). Also added a Ruby safety net to prevent Rails request hangs when async rendering tasks raise before the first chunk. PR 2407 by AbanoubGhadban. - Node renderer duplicate error reports for render failures: Fixed duplicate
errorReporter.messagenotifications when unexpected exceptions occurred in `handleRenderRequ...
v16.4.0.rc.8
Changes since the last non-beta release.
Added
-
TanStack Router SSR integration (Pro): Added
createTanStackRouterRenderFunctionandserverRenderTanStackAppAsyncviareact-on-rails-pro/tanstack-routerfor TanStack Router SSR with the Pro Node Renderer. Uses TanStack Router's publicrouter.load()API for reliable async SSR. Requiresrendering_returns_promises = truein Pro config. PR 2516 by justin808. -
create-react-on-rails-app --rscflow: Added--rscsupport tonpx create-react-on-rails-appso a single command can scaffold an RSC-ready app. The CLI now installsreact_on_rails_pro, passes--rsctoreact_on_rails:install, and points users to/hello_serverafter setup. PR 2430 by justin808. -
Environment-variable-driven ports in Procfile templates: Procfile templates now use
${PORT:-3000}and${SHAKAPACKER_DEV_SERVER_PORT:-3035}instead of hardcoded ports, enabling multiple worktrees to runbin/devconcurrently without port conflicts. Includes aPortSelectorthat auto-detects free ports when defaults are occupied, plus a generated.env.exampledocumenting manual overrides. PR 2539 by ihabadham. -
CSP nonce support for RSC streaming and console replay scripts: Added
cspNoncetorails_contextand threaded nonce values through Pro RSC streaming paths (server-side HTML stream injection and client-side console replay script insertion), with nonce sanitization. PR 2418 by justin808. -
Pro and RSC generator flags: Added
--proand--rscflags torails g react_on_rails:install, plus standalonereact_on_rails:proandreact_on_rails:rscgenerators for upgrading existing apps to Pro and React Server Components. Includes idempotent setup modules, webpack config transforms, prerequisite validation, and example components. PR 2284 by ihabadham. -
Auto-registration for Redux stores: Added
stores_subdirectoryconfiguration option (e.g.,"ror_stores") for automatic Redux store registration, following the same pattern as component auto-registration viaror_components. Store files placed inror_stores/directories are automatically discovered, and packs are generated that callReactOnRails.registerStore(), eliminating manual registration boilerplate. Includesauto_load_bundleparameter for theredux_storehelper. PR 2346 by justin808. -
create-react-on-rails-app CLI tool: New
npx create-react-on-rails-appcommand for single-command project setup. Phase 1 supports JavaScript and TypeScript templates with npm/pnpm, orchestratingrails new+bundle add react_on_rails+rails generate react_on_rails:installwith prerequisite validation and progress output. PR 2375 by justin808. -
Extensible bin/dev precompile pattern: New alternative approach for handling precompile tasks directly in
bin/dev, providing better support for projects with custom build steps (ReScript, TypeScript), direct Ruby API access viaReactOnRails::Locales.compile, and improved version manager compatibility. PR 2349 by justin808. -
Database setup check in bin/dev: The
bin/devcommand now checks database connectivity before starting the development server. This provides clear error messages when the database is missing or unavailable, instead of buried errors in the logs. Note: This adds ~1-2 seconds to startup time as it spawns a Rails runner process.Opt-out options (for apps without databases or when faster startup is needed):
- CLI flag:
bin/dev --skip-database-check - Environment variable:
SKIP_DATABASE_CHECK=true bin/dev - Configuration:
config.check_database_on_dev_start = falseinconfig/initializers/react_on_rails.rb
- CLI flag:
Improved
- Smarter duplicate registration warnings: Component and store registration now only warns when a different component or store is registered under an already-used name. Re-registering the same component (common with HMR) is silently accepted. PR 2354 by justin808.
Fixed
- CSS module SSR fixes for rspack: Fixed CSS module class name divergence between client and server bundles when using rspack. Server webpack config now filters rspack's
cssExtractLoaderin addition tomini-css-extract-plugin, uses spread syntax to preserve existing CSS module options when settingexportOnlyLocals: true, and adds null guards against undefined entries inrule.usearrays. Note:exportOnlyLocals: trueis no longer applied whencssLoader.options.modulesis falsy (disabled), which is the correct behavior but a change from prior versions. PR 2489 by justin808. - Fixed
private_output_pathnot configured on fresh Shakapacker installs: When runningrails g react_on_rails:installwithout pre-existing Shakapacker configuration,private_output_path: ssr-generatedwas left commented out in the generatedconfig/shakapacker.yml. The generator now detects whether Shakapacker was just installed and passes ashakapacker_just_installedflag toBaseGenerator, which usesforce: truewhen copying the config template to ensure the RoR version replaces Shakapacker's default. PR 2411 by ihabadham. - Install generator
--pretendnow behaves as a safe dry run:react_on_rails:installpreviously executed real Shakapacker setup commands (bundle add,bundle install, andrails shakapacker:install) and could crash onFile.chmodbecause Thor pretend mode does not create files.--pretendnow skips automatic Shakapacker installation and raw chmod calls so dry-run previews complete without side effects. PR 2536 by justin808. bin/devhook script path resolution without Rails.root: Fixedresolve_hook_script_pathfailing in early startup (before Rails is initialized) by adding aproject_roothelper that resolves the project root viaBUNDLE_GEMFILEdirname orDir.pwdwhenRails.rootis unavailable. PR 2568 by ihabadham. Fixes Issue 2438.- Rspack generator config path: Fixed
--rspackgenerator placing config files underconfig/webpack/instead ofconfig/rspack/, causing Shakapacker deprecation warnings. All config file destinations are now dynamically remapped based on the active bundler, andusing_rspack?auto-detects rspack projects for standalone generators (react_on_rails:rsc,react_on_rails:pro). PR 2417 by justin808. - Precompile hook load-based execution path: Fixed the precompile hook not executing its tasks when invoked via
load(as used bybin/dev) instead of direct script execution. Added a sharedrun_precompile_tasksentry point that works regardless of invocation method. PR 2419 by justin808. Fixes Issue 2195. create-react-on-rails-appvalidation improvements: Tightened CLI validation to enforce Rails 7+ and app-name leading-letter requirements, with clearer error messages for invalid names containing hyphens or underscores. PR 2577 by justin808.- Install
@babel/preset-reactfor non-SWC generator installs: The generator now installs@babel/preset-reactas a dev dependency when the project uses Babel (not SWC) as the transpiler, fixing JSX compilation errors on fresh installs with older Shakapacker defaults. PR 2421 by justin808. - Fix
react_on_rails:doctorfalse positives for Pro/SWC setups: Doctor now recognizesreact-on-rails-pronpm package for presence and version sync checks, skips@babel/preset-reactcheck when SWC is the transpiler, and fixes a nil-safety bug where missing"dependencies"in package.json silently dropped devDependencies from checks. PR 2581 by ihabadham. - Fixed ScoutApm instrumentation depending on Gemfile ordering. ScoutApm instrumentation for
react_component,react_component_hash, andexec_server_render_jswas previously installed at gem load time usingdefined?(ScoutApm)guards, which meant it was silently skipped ifscout_apmappeared afterreact_on_railsin the Gemfile, and produced noisy INFO log messages if it appeared before (since ScoutApm wasn't yet initialized). Moved instrumentation into an initializer that runs afterscout_apm.start, ensuring it works regardless of gem ordering and only after ScoutApm is fully configured. [PR 2442](https://github....