Added
bin/devdeterministic port allocation viaREACT_ON_RAILS_BASE_PORT(andCONDUCTOR_PORT):bin/devnow derives Rails / webpack-dev-server / node-renderer ports from a single base port whenREACT_ON_RAILS_BASE_PORT(orCONDUCTOR_PORT, for Conductor.build workspaces) is set: Rails =base + 0, webpack =base + 1, renderer =base + 2. This makes parallel worktrees and coding-agent sandboxes collision-free without per-service env vars. The priority chain is base port → explicit per-service env vars (PORT,SHAKAPACKER_DEV_SERVER_PORT) → auto-detection. Behavior note: when base-port mode is active, any pre-setPORT,SHAKAPACKER_DEV_SERVER_PORT,RENDERER_PORT, or non-matchingREACT_RENDERER_URL(and the legacyRENDERER_URL, when already set) is unconditionally overwritten with the derived value (a warning is printed before each override). This applies in allbin/devmodes includingbin/dev prod, whereSHAKAPACKER_DEV_SERVER_PORTis also derived/overwritten for tooling consistency even though the production-like mode does not run webpack-dev-server. Sub-process env preservation: to keep these derived values consistent across spawned processes,bin/devnow also preservesRENDERER_PORT,REACT_RENDERER_URL, andSHAKAPACKER_SKIP_PRECOMPILE_HOOKacross Bundler's env reset (previously onlyPORTandSHAKAPACKER_DEV_SERVER_PORTwere preserved); this prevents nestedshakapackercommands from silently re-running the precompile hook or losing the renderer URL. PR 3142 by justin808.- [Pro]
bin/devauto-derivesREACT_RENDERER_URLfromRENDERER_PORT: When onlyRENDERER_PORTis set,bin/devnow setsREACT_RENDERER_URL=http://localhost:RENDERER_PORTso Rails reaches the right port by default. Users running a remote or non-localhost node renderer (Docker service, remote host) should setREACT_RENDERER_URLexplicitly so it is not replaced with the localhost default. PR 3142 by justin808. - [Pro] Pre-seed renderer cache for Docker builds: New
react_on_rails_pro:pre_seed_renderer_cacherake task copies compiled server bundles into the Node Renderer's bundle-hash cache directory structure during Docker image builds, eliminating the 410→retry cold-start latency (200ms–1s+) on the first SSR request after deployment. SupportsRENDERER_SERVER_BUNDLE_CACHE_PATH, RSC bundles, and rolling-deploy guidance centered on current and previous bundle hashes. The legacypre_stage_bundle_for_node_renderertask now stages the same cache layout via symlinks for same-filesystem workflows. Note:RENDERER_BUNDLE_PATHis now deprecated in favor ofRENDERER_SERVER_BUNDLE_CACHE_PATHacross both tasks. Existing users withRENDERER_BUNDLE_PATHset will see a deprecation warning on stderr. PR 3124 by justin808. - [Pro] Rolling-deploy adapter protocol: New
config.rolling_deploy_adapterpluggable module (protocol:previous_bundle_hashes,fetch,upload) that seeds previously-deployed bundle hashes into the Node Renderer cache, preventing 410→retry for draining-version requests during rolling deploys.assets:precompileauto-callsuploadin production-like environments so the next deploy can fetch the just-built bundle.PREVIOUS_BUNDLE_HASHESenv var overrides discovery for CI.react_on_rails:doctorprobes the adapter and reports protocol conformance, discovery latency, and resolved cache dir. Each seeded hash carries its ownloadable-stats.json/ RSC manifests so client-side hydration stays consistent with the deployed asset pipeline for that hash. Seedocs/pro/rolling-deploy-adapters.mdfor the full protocol spec and reference implementations (S3, Control Plane, Filesystem). PR 3173 by justin808. - [Pro] Async props with incremental React Server Component rendering: Added the
stream_react_component_with_async_propsandrsc_payload_react_component_with_async_propsview helpers, which accept a block to declare props that are fetched concurrently and streamed to the rendering component as each value becomes available. The React component renders its shell immediately (with<Suspense>fallbacks) and progressively re-renders as async prop promises resolve, dramatically improving Time to First Byte for pages with slow data fetches. Components access async props through thegetReactOnRailsAsyncPropfunction injected into props (typed via the newWithAsyncPropsTypeScript helper). Requiresconfig.enable_rsc_support = true. This is an additive feature — existingstream_react_componentandrsc_payload_react_componentcalls are unaffected. PR 2903 by AbanoubGhadban.
Changed
- [Pro]
PreSeedRendererCacheandPrepareNodeRenderBundlesnow auto-stageloadable-stats.json:ReactOnRailsPro::RendererCacheHelpers.collect_assetsnow appendsloadable-stats.jsonwhenever the file exists on disk, so every caller (rolling-deploy seeding,pre_seed_renderer_cache,pre_stage_bundle_for_node_renderer) stages it automatically. Action required for upgraders: if yourassets_to_copyconfig explicitly listedloadable-stats.json, remove that entry — otherwise you'll see a "Duplicate asset basenames in assets_to_copy" warning on every stage. The duplicate is harmless (stage_assetskeeps the last entry per basename), but the warning is noise. PR 3173 by justin808. - [Pro] Unified renderer cache staging:
ReactOnRailsPro::PreSeedRendererCache.call(mode: :copy | :symlink)is now the single entry point for staging the Node Renderer cache. Both modes produce the same<cache>/<bundleHash>/<bundleHash>.jslayout. Thereact_on_rails_pro:pre_seed_renderer_cacherake task acceptsMODE=copy(default; Docker/image builds) orMODE=symlink(same-filesystem). The auto-invocation at the end ofassets:precompiledefaults to:symlink(preserving prior behavior) and now honorsASSETS_PRECOMPILE_RENDERER_CACHE_MODE=copy|symlinkso Docker builds that runrake assets:precompileas the final asset step can opt into copy mode without invoking the rake task separately.MODE=copyraises a clear error when neitherRENDERER_SERVER_BUNDLE_CACHE_PATHnorRENDERER_BUNDLE_PATHis set in non-dev/test environments, because the Node renderer's default lookup can differ from the Ruby side and would silently drop pre-seeded bundles in the wrong directory. The legacyreact_on_rails_pro:pre_stage_bundle_for_node_renderertask andReactOnRailsPro::PrepareNodeRenderBundlesclass remain as deprecated shims that emit a once-per-process warning and delegate tomode: :symlink.react_on_rails:doctorflags deploy scripts that still reference the deprecated task. Heads-up for custom scripts: the previous flat layout wrote$RENDERER_BUNDLE_PATH/<renderer_bundle_file_name>; any external scripts (health checks, renderer launchers) that read that path directly must now read$RENDERER_SERVER_BUNDLE_CACHE_PATH/<bundleHash>/<bundleHash>.jsinstead. PR 3124 by justin808. - [Pro] Pro generator now creates the Node Renderer at
renderer/node-renderer.js: The canonical location for the Node Renderer entry point is now a dedicated top-levelrenderer/directory instead ofclient/, making it straightforward to exclude from production Docker builds that strip JS sources after bundling. Docs and Prospec/dummynow use the new path consistently. Existing apps are unaffected — the generator skips files that already exist (including a legacyclient/node-renderer.js). Fixes Issue 3073. PR 3165 by justin808. - [Pro] Documentation standardized on
REACT_RENDERER_URLenv var name: The configuration example indocs/oss/configuration/configuration-pro.mdnow showsENV["REACT_RENDERER_URL"]instead of the olderENV["RENDERER_URL"], aligning with the rest of the docs and the generator template. Existing apps that readENV["RENDERER_URL"]in their initializer continue to work — the Prorenderer_urlconfig is whichever env var the user reads in their initializer; no gem code reads either name directly. Rename the env var in your infrastructure configs (and update the initializer to match) if you want to align with the new convention.bin/devnow also warns whenRENDERER_URLis set withoutREACT_RENDERER_URLso the rename doesn't silently fall back to the default renderer URL. PR 3142 by justin808. - Length-prefixed streaming wire protocol: The internal protocol between the Rails gems and the Node renderer (and the in-process bundle for the OSS non-streaming path) now uses a length-prefixed framing —
<metadata JSON>\t<content byte length hex>\n<raw content bytes>— instead of wrapping every HTML chunk in a JSON envelope, eliminating ~30% serialize/escape overhead on streamed HTML and correctly handling multibyte content and chunk boundaries. This is an internal transport detail: React on Rails always ships thereact_on_rails/react_on_rails_progems, thereact-on-rails/react-on-rails-pronpm packages, and thereact-on-rails-pro-node-rendereras a matched version set, and the Ruby parser also auto-detects the legacy JSON format, so no application action is required when upgrading all artifacts together. PR 2903 by AbanoubGhadban. react_on_rails:doctorrenderer-cache scan covers CI/CD manifests: The deprecated-task scan that flagsreact_on_rails_pro:pre_stage_bundle_for_node_renderernow also checks.circleci/config.yml,.gitlab-ci.yml,bitbucket-pipelines.yml, every.github/workflows/*.yml/.yaml, and everyconfig/deploy/*.rbstage file, on top of the existing Procfile/Dockerfile/Compose/Kamal/Capistrano/bin/*/scripts/deploy.shpaths. The scan stays bounded: per-file size cap, no**globs, a per-glob match cap, per-file rescue, and a separate per-glob rescue so a single unreadable workflow or stage file cannot abort the rest of the scan. Fixes Issue 3247.- Rspack install scaffolding now targets Rspack v2:
react_on_rails:install --rspackandbin/switch-bundlernow generate the Rspack v2 package line (@rspack/core@^2.0.0-0,@rspack/cli@^2.0.0-0,@rspack/plugin-react-refresh@^2.0.0) while keepingrspack-manifest-plugin@^5.0.0, which is already compatible. Closes Issue 3082. PR 3084 by justin808.
Fixed
- [Pro] Allow patched ruby-jwt releases: React on Rails Pro now requires
jwt >= 3.2.0, removing the previous~> 2.7cap so applications can resolve the patched ruby-jwt release for the empty-key HMAC advisory. PR 3322 by ihabadham. - [Pro] Pro migration generator rewrites all base-package references and preserves Gemfile pins:
rails generate react_on_rails:pronow rewrites Jest/Vitest mock helpers (jest.mock,vi.mock,requireActual/importActual, and the rest) and TypeScriptdeclare module 'react-on-rails'blocks alongside its existingimport/require/dynamic-import handling, and the Gemfile swap now preserves the user's existing version pin (and other gem options) instead of overwriting them with the running gem's version.react_on_rails:doctoris widened to match: it also flags stale side-effect imports (import 'react-on-rails';), Jest/Vitest mock helpers, anddeclare moduleblocks, and the new side-effect-import pattern keeps the doctor a superset of the rewriter so anything the rewriter doesn't reach gets surfaced. Closes Issue 3104. PR 3232 by justin808. - Doctor now honors nested JavaScript package roots:
react_on_rails:doctornow checks package-manager lockfiles,package.json, and installed React from the configurednode_modules_location, reducing false diagnostics for legacy apps that keep dependencies underclient/. The Vite migration guide now documents the supported thin-wrapper pattern for those layouts. Note: a missingpackage.jsonat the configurednode_modules_locationnow emits a warning instead of being silently skipped, so apps misconfigured against a nonexistent path will see new diagnostics on upgrade. Fixes Issue 3205. PR 3220 by justin808. - Generated pack regeneration is now serialized:
generate_packs_if_stalenow uses a Railstmp/lock file, re-checks staleness after waiting, and avoids concurrent cleanup/regeneration races when multiple processes trigger auto-bundling at the same time. Fixes Issue 1627. PR 3231 by justin808. - Install generator validates the selected JavaScript package manager: The install generator now checks the manager selected from
REACT_ON_RAILS_PACKAGE_MANAGER, thepackageManagerfield inpackage.json, or a lockfile on disk — instead of passing when any JavaScript package manager is installed. When the selected command is missing, the error names the selected manager, the source that selected it, and the available alternatives. The generator also warns whenREACT_ON_RAILS_PACKAGE_MANAGERis set to a value outside the supported set (npm,pnpm,yarn,bun). Addresses package manager validation from Issue 1958. PR 3229 by justin808. - Server-render error wrapping preserves original causes: When server rendering catches a non-
Errorthrown value, React on Rails now wraps it with the original value attached ascause, making downstream debugging preserve more context. Fixes Issue 1746. PR 3230 by justin808. bin/devnow cleans copied runtime files before startup: When you duplicate an app directory to run another local dev stack,bin/devnow removes copied stale Overmind sockets and staletmp/pids/server.pidfiles that point to a Puma process running from another app directory. This prevents false startup failures in copied workspaces while still preserving active local sockets and pid files for the current app. PR 3142 by justin808.bin/dev killis more thorough and Pro-aware under base-port mode:ServerManager.kill_processesno longer short-circuits after the first successful step — pattern-based kills, port-based kills, and socket/pid cleanup all run unconditionally so a stale renderer port-binding or socket file cannot survive abin/dev kill. In base-port mode, the derived renderer port (base+2) is now always included in port-based killing whenreact_on_rails_prois loaded, even ifRENDERER_PORT/REACT_RENDERER_URLare unset in the current shell (an informational message is printed so the wider scan is not silent).ProcessManageralso now preserves the legacyRENDERER_URLenv var alongsideREACT_RENDERER_URLacross Bundler's env reset so mid-migration users keep a consistent renderer URL in spawned subprocesses. PR 3274 by justin808.- CI change detection handles shallow clones with long-lived branches:
script/ci-changes-detectorandscript/check-docs-sidebarnow resolve an actual merge base before diffing, deepening shalloworigin/mainand current-branch history as needed.ci-changes-detectornow fails visibly when it cannot compute a safe diff instead of treating git failures as no changes. Fixes Issue 3108. PR 3224 by justin808. - [Pro] Node renderer now exposes
performancewhensupportModules: true: React 19's development build ofReact.lazycallsperformance.now(), which previously threwReferenceError: performance is not definedinside the node renderer's VM context unless users manually addedperformanceviaadditionalContext.performanceis now included in the default globals alongsideBuffer,process, etc. Fixes Issue 3154. PR 3158 by justin808. - Scaffolded CI workflow pins a pnpm version when
packageManageris absent: The generated.github/workflows/ci.ymlnow emitswith: version:forpnpm/action-setup@v4when pnpm is detected frompnpm-lock.yamlalone, preventing the setup step from failing before dependency install. WhenpackageManageris declared inpackage.json, the version key is omitted so the action reads the pin from there. Note:GeneratorMessages.detect_package_manager(package_json: nil)now treatsnilas "caller cached that the file is absent" and skips disk fallback, instead of re-readingpackage.json; the previous fallthrough behavior is now the default (omit the keyword) and is documented onread_package_json. Fixes Issue 3172. PR 3174 by justin808. - Client startup now recovers if initialization begins during
interactiveafterDOMContentLoadedalready fired: React on Rails now still initializes the page when the client bundle starts in the browser timing window afterDOMContentLoadedbut before the document reachescomplete. Fixes Issue 3150. PR 3151 by ihabadham. - Doctor accepts TypeScript server bundle entrypoints:
react_on_rails:doctornow resolves common source entrypoint suffixes (.js,.jsx,.ts,.tsx,.mjs,.cjs) before warning that the server bundle is missing, preventing false positives when apps useserver-bundle.ts. PR 3111 by justin808. - Doctor no longer fails custom projects for a missing generated
bin/dev:react_on_rails:doctornow downgrades a missing official React on Railsbin/devlauncher from an error to a warning and adds explicit guidance when a custom./devscript is detected, so custom projects can pass diagnostics when their development setup is intentional. Fixes Issue 3103. PR 3117 by justin808. - [Pro] Reduced
react-on-rails-pro-node-rendererpublished package size: added afileswhitelist topackage.jsonsopnpm packno longer includessrc/,tests/fixtures,*.map, andlib/tsconfig.tsbuildinfo— matching the convention used by the sibling packages. Also markedreact_on_rails_pro/spec/dummyasprivateso it can never be accidentally published. PR 3304 by alexeyr-ci2. - [Pro] HTTPX bidirectional streaming reliability: Fixed streaming request timeouts when using HTTPX with both the
:streamand:stream_bidiplugins. The request now uses thebuild_requestpattern with an explicitrequest.closeso the HTTP/2END_STREAMflag is sent, and a temporary monkey-patch (httpx_stream_bidi_patch.rb) works around an upstream:stream_bidiretry bug that left stale body callbacks registered and crashed retried requests withprotocol_error. The patch is scoped and will be removed once fixed upstream. PR 2903 by AbanoubGhadban. - [Pro] Progressive RSC streaming flush granularity: RSC streaming now flushes on React's per-render-cycle
flush()signal instead ofsetTimeout(flush, 0), so the shell and each resolved<Suspense>boundary stream as separate chunks rather than being merged into one large first message. This restores progressive streaming (and fixes worse-than-SSR First Contentful Paint) on pages with fast queries, and eliminates partial-HTML-tag chunks. Fixes Issue 3194. PR 2903 by AbanoubGhadban. - [Pro] Node renderer graceful shutdown after stream timeouts: Fixed workers taking 30+ seconds to shut down after a
StreamChunkTimeoutErrorduring streaming.handleGracefulShutdownnow also decrements the active-request count ononRequestAbort/onTimeout, thePassThroughwrapper is destroyed when the source render stream errors, and the HTTP response is closed on chunk timeout so connections to Rails no longer hang. Fixes Issue 2270 and Issue 2308. PR 2903 by AbanoubGhadban.
Removed
- [Pro] Removed the
--rsc-proinstall generator flag:--rscalready implies Pro, so the separate mode was unnecessary. Behaviors previously gated on--rsc-pro(Pro verification checklist, prerelease install note, exact Pro gem pin on prereleases) now fire on--rscinstalls. See also Issue 3104, which tracks unrelated silent-failure bugs in the Pro upgrade automation. PR 3105 by ihabadham.