github shakacode/react_on_rails v17.0.0.rc.1

pre-release6 hours ago

Breaking Changes

  • Ruby 3.3+ is required for React on Rails v17: The open-source gem now requires Ruby >= 3.3.0, aligning it with React on Rails Pro, create-react-on-rails-app, and the CI minimum matrix. React on Rails v16 remains the upgrade path for applications that must stay on Ruby 3.2 or older. PR 3500 by justin808.

Added

  • [Pro] Imperative refetch API for <RSCRoute>: <RSCRoute> now accepts an optional ref typed as RSCRouteHandle, exposing refetch() so a parent or sibling can refetch a server component without knowing its componentName or componentProps. A new useCurrentRSCRoute() hook returns the same handle for client components rendered inside the RSC subtree (for example, an inline "Refresh" button rendered by the server component itself); calling it outside an <RSCRoute> ancestor throws useCurrentRSCRoute must be used inside an <RSCRoute>. Both APIs auto-update the rendered tree with no caller-side setKey/useState workaround and propagate to every <RSCRoute> instance bound to the same cache key. The internal cache invalidation runs inside a React transition, so old content stays visible while the new RSC payload streams in without a Suspense-fallback flash. The existing useRSC().refetchComponent(name, props) API and the ServerComponentFetchError-based retry flow are unchanged. Fixes Issue 3106. PR 3552 by AbanoubGhadban.
  • [Pro] <RSCRoute ssr={false}> defers initial RSC payload generation: <RSCRoute> now accepts ssr={false} to skip server-side RSC payload generation for that route — the server streams the nearest <Suspense> fallback and the client fetches the payload through the existing RSCProvider path (cache lookup, /rsc_payload/:componentName fetch, ServerComponentFetchError, and useRSC().refetchComponent(...) retry). ssr defaults to true, so existing routes are unchanged and a mixed page can server-render some routes while deferring others. Deferred roots that do not manually call wrapServerComponentRenderer are now supported automatically: RSC-enabled generated client packs register a default RSC provider (also exported as react-on-rails-pro/registerDefaultRSCProvider/client for manual entrypoints) that wraps auto-bundled react_component(..., prerender: false) and deferred-only stream_react_component roots. Completes Issue 3101. PR 3318, PR 3394 by ihabadham.
  • Ruby 4.0 CI support: Updated OSS latest-runtime CI coverage, local CI switching guidance, and public compatibility docs to test Ruby 4.0 while keeping Ruby 3.3 as the minimum supported CI lane. PR 3529 by justin808.
  • [Pro] HTTP rolling-deploy endpoint auto-mount: Configuring config.rolling_deploy_adapter = ReactOnRailsPro::RollingDeployAdapters::Http now automatically mounts ReactOnRailsPro::RollingDeploy::BundlesController at config.rolling_deploy_mount_path (default /react_on_rails_pro/rolling_deploy). Set the mount path to nil or blank to opt out and keep a manual draw_routes mount; apps that previously mounted the default route manually should remove that route or give secondary manual mounts a distinct as_prefix: to avoid duplicate named-route errors. Fixes Issue 3476. PR 3504 by justin808.

Changed

  • Generator defaults to Rspack for fresh installs: rails generate react_on_rails:install and create-react-on-rails-app now default to the Rspack bundler on fresh installs (significantly faster builds via SWC), instead of Webpack. Pass --no-rspack (or its alias --webpack) to use Webpack. This only affects fresh installs — existing apps that already declare an assets_bundler in config/shakapacker.yml are left unchanged, an explicit --rspack/--no-rspack/--webpack always wins, and the default falls back to Webpack on Shakapacker versions below 9.0 (where Rspack is unsupported). PR 3484 by justin808.

Improved

  • RSC setup verification warns on dynamic plugin options: react_on_rails:install --rsc now warns when new RSCWebpackPlugin(...) uses computed options that cannot be statically verified, avoiding misleading missing-clientReferences reports for dynamic config. Fixes Issue 3412. PR 3505 by justin808.
  • Rspack-aware diagnostics and dev-server help: Doctor, system checker, and bin/dev --help output now label Rspack apps as Rspack instead of webpack while preserving webpack wording for default apps. Fixes Issue 3388. PR 3508 by justin808.

Fixed

  • Shakapacker config warnings now report resolved relative paths: When SHAKAPACKER_CONFIG is set to a relative missing path, the Rails boot warning now includes the Rails-root-resolved path that React on Rails actually checked. Fixes Issue 3436. PR 3441 by justin808.
  • Base-port renderer URLs preserve localhost-equivalent hosts: bin/dev base-port mode now keeps localhost-equivalent renderer hosts and schemes, such as 127.0.0.1 and https://localhost, when deriving REACT_RENDERER_URL; remote or invalid hosts still fall back to http://localhost:<port>. Fixes Issue 3466. PR 3506 by justin808.
  • [Pro] Streamed RSC rendering now propagates CSP nonces: React on Rails Pro now passes the Rails CSP nonce to React's streamed RSC renderer options so streamed script output can satisfy strict content security policies. Fixes Issue 3491. PR 3507 by justin808.
  • [Pro] RSC stream parser tolerates blank separator lines: LengthPrefixedStreamParser now skips blank separator lines (including a lone CR from a split CRLF) between length-prefixed records instead of treating them as malformed headers, matching the default Pro RSC payload template that inserts extra newlines between chunks. Malformed non-empty headers still raise as before, and a stream ending mid-\r\n no longer logs a spurious incomplete-stream warning. Fixes Issue 3499. PR 3515 by justin808.
  • Generated build scripts run the auto-bundle hook before building bundles: Newly generated apps now run the Shakapacker precompile (auto-bundle) hook before the generated build, build:test, scaffolded CI, and build_test_command bundle builds, so packs are regenerated before bundling. Apps with custom Shakapacker hooks keep them under Shakapacker's control so the hook does not double-run. PR 3535 by justin808.

Don't miss a new react_on_rails release

NewReleases is sending notifications on new releases.