Skip to content

Commit

Permalink
rename stream_react_component_async to stream_react_component
Browse files Browse the repository at this point in the history
  • Loading branch information
AbanoubGhadban committed Jul 28, 2024
1 parent 0c9955a commit de1d60e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/react_on_rails/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,8 @@ def react_component(component_name, options = {})
end

def stream_react_component(component_name, options = {})
options = options.merge(stream?: true)
result = internal_react_component(component_name, options)
build_react_component_result_for_server_streamed_content(
rendered_html_stream: result[:result],
component_specification_tag: result[:tag],
render_options: result[:render_options]
)
end

def stream_react_component_async(component_name, options = {})
rendering_fiber = Fiber.new do
stream = stream_react_component(component_name, options)
stream = stream_react_component_internal(component_name, options)
stream.each_chunk do |chunk|
Fiber.yield chunk
end
Expand Down Expand Up @@ -362,6 +352,16 @@ def load_pack_for_generated_component(react_component_name, render_options)

private

def stream_react_component_internal(component_name, options = {})
options = options.merge(stream?: true)
result = internal_react_component(component_name, options)
build_react_component_result_for_server_streamed_content(
rendered_html_stream: result[:result],
component_specification_tag: result[:tag],
render_options: result[:render_options]
)
end

def generated_components_pack_path(component_name)
"#{ReactOnRails::PackerUtils.packer_source_entry_path}/generated/#{component_name}.js"
end
Expand Down

0 comments on commit de1d60e

Please sign in to comment.