Skip to content

Commit 78d5717

Browse files
Phase 1: Update documentation and CHANGELOG for Pro feature separation
- Updated CHANGELOG.md with breaking changes for RSC configs and streaming helpers - Updated react_on_rails_pro/CHANGELOG.md to document additions to Pro gem - Moved RSC configuration documentation to Pro gem docs - Added Pro-only view helpers section consolidating all Pro helpers - Added prominent Pro feature notices to streaming documentation - Removed inaccurate claims about error behavior Related to #1874
1 parent 64dc33a commit 78d5717

File tree

5 files changed

+134
-36
lines changed

5 files changed

+134
-36
lines changed

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,37 @@ To migrate to React on Rails Pro:
7373

7474
**Note:** If you're not using any of the Pro-only methods listed above, no changes are required.
7575

76+
- **Pro-Specific Configurations Moved to Pro Gem**: The following React Server Components (RSC) configurations have been moved from `ReactOnRails.configure` to `ReactOnRailsPro.configure`:
77+
- `rsc_bundle_js_file` - Path to the RSC bundle file
78+
- `react_server_client_manifest_file` - Path to the React server client manifest
79+
- `react_client_manifest_file` - Path to the React client manifest
80+
81+
**Migration:** If you're using RSC features, move these configurations from your `ReactOnRails.configure` block to `ReactOnRailsPro.configure`:
82+
83+
```ruby
84+
# Before
85+
ReactOnRails.configure do |config|
86+
config.rsc_bundle_js_file = "rsc-bundle.js"
87+
config.react_server_client_manifest_file = "react-server-client-manifest.json"
88+
config.react_client_manifest_file = "react-client-manifest.json"
89+
end
90+
91+
# After
92+
ReactOnRailsPro.configure do |config|
93+
config.rsc_bundle_js_file = "rsc-bundle.js"
94+
config.react_server_client_manifest_file = "react-server-client-manifest.json"
95+
config.react_client_manifest_file = "react-client-manifest.json"
96+
end
97+
```
98+
99+
See the [React on Rails Pro Configuration docs](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/docs/configuration.md) for more details.
100+
101+
- **Streaming View Helpers Moved to Pro Gem**: The following view helpers have been removed from the open-source gem and are now only available in React on Rails Pro:
102+
- `stream_react_component` - Progressive SSR using React 18+ streaming
103+
- `rsc_payload_react_component` - RSC payload rendering
104+
105+
These helpers are now defined exclusively in the `react-on-rails-pro` gem.
106+
76107
### [16.1.1] - 2025-09-24
77108

78109
#### Bug Fixes

docs/api-reference/configuration.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -104,30 +104,21 @@ ReactOnRails.configure do |config|
104104
# you should include a name that matches your bundle name in your Webpack config.
105105
config.server_bundle_js_file = "server-bundle.js"
106106

107-
# When using React on Rails Pro with RSC support enabled, these configuration options work together:
108-
#
109-
# 1. In RORP, set `config.enable_rsc_support = true` in your react_on_rails_pro.rb initializer
110-
#
111-
# 2. The `rsc_bundle_js_file` (typically "rsc-bundle.js") contains only server components and
112-
# references to client components. It's generated using the RSC Webpack Loader which transforms
113-
# client components into references. This bundle is specifically used for generating RSC payloads
114-
# and is configured with the `react-server` condition.
115-
config.rsc_bundle_js_file = "rsc-bundle.js"
107+
################################################################################
108+
# REACT SERVER COMPONENTS (RSC) AND STREAMING CONFIGURATION
109+
################################################################################
116110
#
117-
# 3. The `react_client_manifest_file` contains mappings for client components that need hydration.
118-
# It's generated by the React Server Components Webpack plugin and is required for client-side
119-
# hydration of components.
120-
# This manifest file is automatically generated by the React Server Components Webpack plugin. Only set this if you've configured the plugin to use a different filename.
121-
config.react_client_manifest_file = "react-client-manifest.json"
111+
# React Server Components and Streaming SSR are React on Rails Pro features.
112+
# For detailed configuration of RSC and streaming features, see:
113+
# https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/docs/configuration.md
122114
#
123-
# 4. The `react_server_client_manifest_file` is used during server-side rendering with RSC to
124-
# properly resolve references between server and client components.
115+
# Key Pro configurations (configured in ReactOnRailsPro.configure block):
116+
# - rsc_bundle_js_file: Path to RSC bundle
117+
# - react_client_manifest_file: Client component manifest for RSC
118+
# - react_server_client_manifest_file: Server manifest for RSC
119+
# - enable_rsc_support: Enable React Server Components
125120
#
126-
# These files are crucial when implementing React Server Components with streaming, which offers
127-
# benefits like reduced JavaScript bundle sizes, faster page loading, and selective hydration
128-
# of client components.
129-
# This manifest file is automatically generated by the React Server Components Webpack plugin. Only set this if you've configured the plugin to use a different filename.
130-
config.react_server_client_manifest_file = "react-server-client-manifest.json"
121+
# See Pro documentation for complete setup instructions.
131122

132123
################################################################################
133124
# SERVER BUNDLE SECURITY AND ORGANIZATION

docs/api-reference/view-helpers-api.md

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,6 @@ export default (props, _railsContext) => {
8080

8181
---
8282

83-
### cached_react_component and cached_react_component_hash
84-
85-
Fragment caching is a [React on Rails Pro](https://github.com/shakacode/react_on_rails/wiki) feature. The API is the same as the above, but for 2 differences:
86-
87-
1. The `cache_key` takes the same parameters as any Rails `cache` view helper.
88-
1. The **props** are passed via a block so that evaluation of the props is not done unless the cache is broken. Suppose you put your props calculation into some method called `some_slow_method_that_returns_props`:
89-
90-
```erb
91-
<%= cached_react_component("App", cache_key: [@user, @post], prerender: true) do
92-
some_slow_method_that_returns_props
93-
end %>
94-
```
95-
96-
---
97-
9883
### rails_context
9984

10085
You can call `rails_context` or `rails_context(server_side: true|false)` from your controller or view to see what values are in the Rails Context. Pass true or false depending on whether you want to see the server-side or the client-side `rails_context`. Typically, for computing cache keys, you should leave `server_side` as the default true. When calling this from a controller method, use `helpers.rails_context`.
@@ -132,6 +117,45 @@ This is a helper method that takes any JavaScript expression and returns the out
132117

133118
---
134119

120+
## Pro-Only View Helpers
121+
122+
The following view helpers are available exclusively with [React on Rails Pro](https://www.shakacode.com/react-on-rails-pro). These require a valid React on Rails Pro license and will not be available if the Pro gem is not installed or properly licensed.
123+
124+
### cached_react_component and cached_react_component_hash
125+
126+
Fragment caching helpers that cache React component rendering to improve performance. The API is the same as `react_component` and `react_component_hash`, but with these differences:
127+
128+
1. The `cache_key` takes the same parameters as any Rails `cache` view helper.
129+
2. The **props** are passed via a block so that evaluation of the props is not done unless the cache is broken.
130+
131+
Example usage:
132+
133+
```erb
134+
<%= cached_react_component("App", cache_key: [@user, @post], prerender: true) do
135+
some_slow_method_that_returns_props
136+
end %>
137+
```
138+
139+
### stream_react_component
140+
141+
Progressive server-side rendering using React 18+ streaming with `renderToPipeableStream`. This enables:
142+
- Faster Time to First Byte (TTFB)
143+
- Progressive page loading with Suspense boundaries
144+
- Better perceived performance
145+
146+
See the [Streaming Server Rendering guide](../building-features/streaming-server-rendering.md) for usage details.
147+
148+
### rsc_payload_react_component
149+
150+
Renders React Server Component (RSC) payloads in NDJSON format for client-side consumption. Used in conjunction with RSC support to enable:
151+
- Reduced JavaScript bundle sizes
152+
- Server-side data fetching
153+
- Selective client-side hydration
154+
155+
See the [React on Rails Pro Configuration](https://github.com/shakacode/react_on_rails/blob/master/react_on_rails_pro/docs/configuration.md) for RSC setup.
156+
157+
---
158+
135159
# More details
136160

137161
See the [lib/react_on_rails/helper.rb](https://github.com/shakacode/react_on_rails/tree/master/lib/react_on_rails/helper.rb) source.

react_on_rails_pro/CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,21 @@ You can find the **package** version numbers from this repo's tags and below in
1919
### Added
2020
- Added `cached_stream_react_component` helper method, similar to `cached_react_component` but for streamed components.
2121
- **License Validation System**: Implemented comprehensive JWT-based license validation with offline verification using RSA-256 signatures. License validation occurs at startup in both Ruby and Node.js environments. Supports required fields (`sub`, `iat`, `exp`) and optional fields (`plan`, `organization`, `iss`). FREE evaluation licenses are available for 3 months at [shakacode.com/react-on-rails-pro](https://shakacode.com/react-on-rails-pro). [PR #1857](https://github.com/shakacode/react_on_rails/pull/1857) by [AbanoubGhadban](https://github.com/AbanoubGhadban).
22+
- **Pro-Specific Configurations Moved from Open-Source**: The following React Server Components (RSC) configurations are now exclusively in the Pro gem and should be configured in `ReactOnRailsPro.configure`:
23+
- `rsc_bundle_js_file` - Path to the RSC bundle file
24+
- `react_server_client_manifest_file` - Path to the React server client manifest
25+
- `react_client_manifest_file` - Path to the React client manifest
26+
27+
These configurations were previously available in the open-source `ReactOnRails.configure` block but have been moved to Pro where they belong since RSC is a Pro-only feature.
28+
- **Streaming View Helpers Now Pro-Exclusive**: The following view helpers are now defined exclusively in the Pro gem:
29+
- `stream_react_component` - Progressive SSR using React 18+ streaming
30+
- `rsc_payload_react_component` - RSC payload rendering
31+
32+
These helpers were previously in the open-source gem but have been moved to Pro as they are Pro-only features.
2233

2334
### Changed (Breaking)
2435
- `config.prerender_caching`, which controls caching for non-streaming components, now also controls caching for streamed components. To disable caching for an individual render, pass `internal_option(:skip_prerender_cache)`.
36+
- **Configuration Migration Required**: If you are using RSC features, you must move the RSC-related configurations from `ReactOnRails.configure` to `ReactOnRailsPro.configure` in your initializers. See the migration example in the [React on Rails CHANGELOG](https://github.com/shakacode/react_on_rails/blob/master/CHANGELOG.md#unreleased).
2537

2638
## [4.0.0-rc.15] - 2025-08-11
2739

react_on_rails_pro/docs/configuration.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,45 @@ ReactOnRailsPro.configure do |config|
121121
Rails.root.join("public", "webpack", Rails.env, "loadable-stats.json"),
122122
Rails.root.join("public", "webpack", Rails.env, "manifest.json")
123123
]
124+
125+
################################################################################
126+
# REACT SERVER COMPONENTS (RSC) CONFIGURATION
127+
################################################################################
128+
129+
# Enable React Server Components support
130+
# When enabled, React on Rails Pro will support RSC rendering and streaming
131+
# Default is false
132+
config.enable_rsc_support = true
133+
134+
# Path to the RSC bundle file (relative to webpack output directory or absolute path)
135+
# The RSC bundle contains only server components and references to client components.
136+
# It's generated using the RSC Webpack Loader which transforms client components into
137+
# references. This bundle is specifically used for generating RSC payloads and is
138+
# configured with the 'react-server' condition.
139+
# Default is "rsc-bundle.js"
140+
config.rsc_bundle_js_file = "rsc-bundle.js"
141+
142+
# Path to the React client manifest file (typically in your webpack output directory)
143+
# This manifest contains mappings for client components that need hydration.
144+
# It's automatically generated by the React Server Components Webpack plugin and is
145+
# required for client-side hydration of components.
146+
# Only set this if you've configured the plugin to use a different filename.
147+
# Default is "react-client-manifest.json"
148+
config.react_client_manifest_file = "react-client-manifest.json"
149+
150+
# Path to the React server-client manifest file (typically in your webpack output directory)
151+
# This manifest is used during server-side rendering with RSC to properly resolve
152+
# references between server and client components.
153+
# It's automatically generated by the React Server Components Webpack plugin.
154+
# Only set this if you've configured the plugin to use a different filename.
155+
# Default is "react-server-client-manifest.json"
156+
config.react_server_client_manifest_file = "react-server-client-manifest.json"
157+
158+
# These RSC configuration files are crucial when implementing React Server Components
159+
# with streaming, which offers benefits like:
160+
# - Reduced JavaScript bundle sizes
161+
# - Faster page loading
162+
# - Selective hydration of client components
163+
# - Progressive rendering with Suspense boundaries
124164
end
125165
```

0 commit comments

Comments
 (0)