react_on_rails_pro 17.0.0.rc.11 → 17.0.0.rc.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3d36e0dd82c3e50be01aaf9204135207bd96a86ce4f6dcb4c1deb92e8afd7aba
|
|
4
|
+
data.tar.gz: 4e5285618533469d266be67ff7a654fc3d0703bb9e9e503f09ecba12be980fa3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2505a9d2b0d1b637d7cfdb15424459092c0ab8cec73e23736dc71179565418d991a8f20ced8fa90d71c1e1275d8e2737cfce3c1851b0c658c568481d4d8ad064
|
|
7
|
+
data.tar.gz: 23b8e1a5185d3846cfa8138e5af0c7b94f7d795cf25c355174e3576d35e4d6f8fefa21bebb0d5e4ce7ede51175168941976fa63ccd8abf4aa956b843d44e4f93
|
data/Gemfile.lock
CHANGED
|
@@ -9,7 +9,7 @@ GIT
|
|
|
9
9
|
PATH
|
|
10
10
|
remote: ..
|
|
11
11
|
specs:
|
|
12
|
-
react_on_rails (17.0.0.rc.
|
|
12
|
+
react_on_rails (17.0.0.rc.12)
|
|
13
13
|
addressable
|
|
14
14
|
connection_pool
|
|
15
15
|
execjs (~> 2.5)
|
|
@@ -20,14 +20,14 @@ PATH
|
|
|
20
20
|
PATH
|
|
21
21
|
remote: .
|
|
22
22
|
specs:
|
|
23
|
-
react_on_rails_pro (17.0.0.rc.
|
|
23
|
+
react_on_rails_pro (17.0.0.rc.12)
|
|
24
24
|
async (>= 2.29)
|
|
25
25
|
async-http (~> 0.95)
|
|
26
26
|
execjs (~> 2.9)
|
|
27
27
|
io-endpoint (~> 0.17.0)
|
|
28
28
|
jwt (>= 2.5, < 4)
|
|
29
29
|
nokogiri (>= 1.12, < 2)
|
|
30
|
-
react_on_rails (= 17.0.0.rc.
|
|
30
|
+
react_on_rails (= 17.0.0.rc.12)
|
|
31
31
|
|
|
32
32
|
GEM
|
|
33
33
|
remote: https://rubygems.org/
|
|
@@ -264,6 +264,12 @@ module ReactOnRailsProHelper
|
|
|
264
264
|
# @see https://reactonrails.com/docs/pro/react-server-components/how-react-server-components-work
|
|
265
265
|
# for technical details about the RSC payload format
|
|
266
266
|
def rsc_payload_react_component(component_name, options = {})
|
|
267
|
+
unless ReactOnRailsPro.configuration.enable_rsc_support
|
|
268
|
+
raise ReactOnRailsPro::Error,
|
|
269
|
+
"rsc_payload_react_component requires enable_rsc_support to be true. " \
|
|
270
|
+
"Set `config.enable_rsc_support = true` in your ReactOnRailsPro configuration."
|
|
271
|
+
end
|
|
272
|
+
|
|
267
273
|
# rsc_payload_react_component doesn't have the prerender option
|
|
268
274
|
# Because setting prerender to false will not do anything
|
|
269
275
|
options[:prerender] = true
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
module ReactOnRailsPro
|
|
17
17
|
module ServerRenderingJsCode
|
|
18
|
+
PLAIN_STREAMING_RENDER_FUNCTION_NAME =
|
|
19
|
+
"ReactOnRails.isServerStreamingSupported() ? " \
|
|
20
|
+
"'streamServerRenderedReactComponent' : 'serverRenderReactComponent'"
|
|
21
|
+
|
|
18
22
|
class << self
|
|
19
23
|
def ssr_pre_hook_js
|
|
20
24
|
ReactOnRailsPro.configuration.ssr_pre_hook_js || ""
|
|
@@ -106,32 +110,42 @@ module ReactOnRailsPro
|
|
|
106
110
|
# @param render_options [Object] Options that control the rendering behavior
|
|
107
111
|
# @return [String] JavaScript code that will render the React component on the server
|
|
108
112
|
def render(props_string, rails_context, redux_stores, react_component_name, render_options)
|
|
113
|
+
rsc_support_enabled = ReactOnRailsPro.configuration.enable_rsc_support
|
|
109
114
|
render_function_name =
|
|
110
|
-
if
|
|
115
|
+
if rsc_support_enabled && render_options.streaming?
|
|
111
116
|
# Select appropriate function based on whether the rendering request is running on server or rsc bundle
|
|
112
117
|
# As the same rendering request is used to generate the rsc payload and SSR the component.
|
|
113
118
|
"ReactOnRails.isRSCBundle ? 'serverRenderRSCReactComponent' : 'streamServerRenderedReactComponent'"
|
|
119
|
+
elsif render_options.streaming?
|
|
120
|
+
PLAIN_STREAMING_RENDER_FUNCTION_NAME
|
|
114
121
|
else
|
|
115
122
|
"'serverRenderReactComponent'"
|
|
116
123
|
end
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
streaming_params = if rsc_support_enabled && render_options.streaming?
|
|
125
|
+
config = ReactOnRailsPro.configuration
|
|
126
|
+
react_client_manifest_file = config.react_client_manifest_file
|
|
127
|
+
react_server_client_manifest_file = config.react_server_client_manifest_file
|
|
128
|
+
<<-JS
|
|
129
|
+
railsContext.reactClientManifestFileName = #{react_client_manifest_file.to_json};
|
|
130
|
+
railsContext.reactServerClientManifestFileName = #{react_server_client_manifest_file.to_json};
|
|
131
|
+
JS
|
|
132
|
+
elsif render_options.streaming?
|
|
133
|
+
# These keys are part of the streaming renderer contract, but non-RSC builds do not
|
|
134
|
+
# produce RSC manifests. Empty names avoid a failed filesystem lookup on the shell path.
|
|
135
|
+
<<-JS
|
|
136
|
+
railsContext.reactClientManifestFileName = "";
|
|
137
|
+
railsContext.reactServerClientManifestFileName = "";
|
|
138
|
+
JS
|
|
139
|
+
else
|
|
140
|
+
""
|
|
141
|
+
end
|
|
128
142
|
|
|
129
143
|
# This function is called with specific componentName and props when generateRSCPayload is invoked
|
|
130
144
|
# In that case, it replaces the empty () with ('componentName', props) in the rendering request
|
|
131
145
|
<<-JS
|
|
132
146
|
(function(componentName = #{react_component_name.to_json}, props = undefined) {
|
|
133
147
|
var railsContext = #{rails_context};
|
|
134
|
-
#{
|
|
148
|
+
#{streaming_params}
|
|
135
149
|
#{generate_rsc_payload_js_function(render_options)}
|
|
136
150
|
#{ssr_pre_hook_js}
|
|
137
151
|
#{redux_stores}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: react_on_rails_pro
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 17.0.0.rc.
|
|
4
|
+
version: 17.0.0.rc.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Gordon
|
|
@@ -111,14 +111,14 @@ dependencies:
|
|
|
111
111
|
requirements:
|
|
112
112
|
- - '='
|
|
113
113
|
- !ruby/object:Gem::Version
|
|
114
|
-
version: 17.0.0.rc.
|
|
114
|
+
version: 17.0.0.rc.12
|
|
115
115
|
type: :runtime
|
|
116
116
|
prerelease: false
|
|
117
117
|
version_requirements: !ruby/object:Gem::Requirement
|
|
118
118
|
requirements:
|
|
119
119
|
- - '='
|
|
120
120
|
- !ruby/object:Gem::Version
|
|
121
|
-
version: 17.0.0.rc.
|
|
121
|
+
version: 17.0.0.rc.12
|
|
122
122
|
- !ruby/object:Gem::Dependency
|
|
123
123
|
name: bundler
|
|
124
124
|
requirement: !ruby/object:Gem::Requirement
|