Skip to content

Commit 35b4b77

Browse files
remove prerender option for stream_react_component
1 parent c61eb1f commit 35b4b77

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/react_on_rails/helper.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,13 @@ def react_component(component_name, options = {})
119119
# @option options [Hash] :props Props to pass to the react component
120120
# @option options [String] :dom_id DOM ID of the component container
121121
# @option options [Hash] :html_options Options passed to content_tag
122-
# @option options [Boolean] :prerender Set to false to disable server-side rendering
123122
# @option options [Boolean] :trace Set to true to add extra debugging information to the HTML
124123
# @option options [Boolean] :raise_on_prerender_error Set to true to raise exceptions during server-side rendering
125124
# Any other options are passed to the content tag, including the id.
126125
def stream_react_component(component_name, options = {})
126+
# stream_react_component doesn't have the prerender option
127+
# Because setting prerender to false is equivalent to calling react_component with prerender: false
128+
options[:prerender] = true
127129
options = options.merge(force_load: true) unless options.key?(:force_load)
128130
run_stream_inside_fiber do
129131
internal_stream_react_component(component_name, options)
@@ -186,6 +188,8 @@ def stream_react_component(component_name, options = {})
186188
# @see https://www.shakacode.com/react-on-rails-pro/docs/how-react-server-components-works.md
187189
# for technical details about the RSC payload format
188190
def rsc_payload_react_component(component_name, options = {})
191+
# rsc_payload_react_component doesn't have the prerender option
192+
# Because setting prerender to false will not do anything
189193
options[:prerender] = true
190194
run_stream_inside_fiber do
191195
internal_rsc_payload_react_component(component_name, options)

0 commit comments

Comments
 (0)