Skip to content

Commit dbcaa76

Browse files
Rename RSC rendering methods and configuration to payload generation
1 parent 7f49c24 commit dbcaa76

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

lib/react_on_rails/helper.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,10 @@ def stream_react_component(component_name, options = {})
130130
end
131131
end
132132

133-
def rsc_react_component(component_name, options = {})
133+
def rsc_payload_react_component(component_name, options = {})
134134
options[:prerender] = true
135135
run_stream_inside_fiber do
136-
internal_rsc_react_component(component_name, options)
136+
internal_rsc_payload_react_component(component_name, options)
137137
end
138138
end
139139

@@ -433,7 +433,7 @@ def internal_stream_react_component(component_name, options = {})
433433
)
434434
end
435435

436-
def internal_rsc_react_component(react_component_name, options = {})
436+
def internal_rsc_payload_react_component(react_component_name, options = {})
437437
options = options.merge(render_mode: :rsc_payload_streaming)
438438
render_options = create_render_options(react_component_name, options)
439439
json_stream = server_rendered_react_component(render_options)

lib/react_on_rails/packs_generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ def pack_file_contents(file_path)
9393
ReactOnRailsPro.configuration.enable_rsc_support
9494

9595
if load_server_components && !client_entrypoint?(file_path)
96-
rsc_rendering_url_path = ReactOnRailsPro.configuration.rsc_rendering_url_path
96+
rsc_payload_generation_url_path = ReactOnRailsPro.configuration.rsc_payload_generation_url_path
9797

9898
return <<~FILE_CONTENT.strip
9999
import registerServerComponent from 'react-on-rails/registerServerComponent';
100100
101101
registerServerComponent({
102-
rscRenderingUrlPath: "#{rsc_rendering_url_path}",
102+
rscRenderingUrlPath: "#{rsc_payload_generation_url_path}",
103103
}, "#{registered_component_name}")
104104
FILE_CONTENT
105105
end

spec/dummy/spec/packs_generator_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module ReactOnRails
2424
before do
2525
stub_const("ReactOnRailsPro", Class.new do
2626
def self.configuration
27-
@configuration ||= Struct.new(:enable_rsc_support, :rsc_rendering_url_path).new(false, nil)
27+
@configuration ||= Struct.new(:enable_rsc_support, :rsc_payload_generation_url_path).new(false, nil)
2828
end
2929
end)
3030
ReactOnRails.configuration.server_bundle_js_file = server_bundle_js_file
@@ -216,15 +216,15 @@ def self.configuration
216216

217217
context "when RSC support is enabled" do
218218
let(:components_directory) { "ReactServerComponents" }
219-
let(:rsc_rendering_url_path) { "/rsc" }
219+
let(:rsc_payload_generation_url_path) { "/rsc" }
220220

221221
before do
222222
stub_packer_source_path(component_name: components_directory,
223223
packer_source_path: packer_source_path)
224224
allow(ReactOnRails::Utils).to receive(:react_on_rails_pro?).and_return(true)
225225
allow(ReactOnRailsPro.configuration).to receive_messages(
226226
enable_rsc_support: true,
227-
rsc_rendering_url_path: rsc_rendering_url_path
227+
rsc_payload_generation_url_path: rsc_payload_generation_url_path
228228
)
229229
end
230230

@@ -241,7 +241,7 @@ def self.configuration
241241
import registerServerComponent from 'react-on-rails/registerServerComponent';
242242
243243
registerServerComponent({
244-
rscRenderingUrlPath: "#{rsc_rendering_url_path}",
244+
rscRenderingUrlPath: "#{rsc_payload_generation_url_path}",
245245
}, "#{component_name}")
246246
CONTENT
247247

@@ -277,7 +277,7 @@ def self.configuration
277277
import registerServerComponent from 'react-on-rails/registerServerComponent';
278278
279279
registerServerComponent({
280-
rscRenderingUrlPath: "#{rsc_rendering_url_path}",
280+
rscRenderingUrlPath: "#{rsc_payload_generation_url_path}",
281281
}, "#{component_name}")
282282
CONTENT
283283

0 commit comments

Comments
 (0)