@@ -431,29 +431,28 @@ def build_react_component_result_for_server_rendered_string(
431431 end
432432
433433 def build_react_component_result_for_server_streamed_content (
434- rendered_html_stream : required ( "rendered_html_stream" ) ,
435- component_specification_tag : required ( "component_specification_tag" ) ,
436- render_options : required ( "render_options" )
434+ rendered_html_stream :,
435+ component_specification_tag :,
436+ render_options :
437437 )
438438 is_first_chunk = true
439439 rendered_html_stream . transform do |chunk_json_result |
440440 if is_first_chunk
441441 is_first_chunk = false
442- next build_react_component_result_for_server_rendered_string (
442+ build_react_component_result_for_server_rendered_string (
443443 server_rendered_html : chunk_json_result [ "html" ] ,
444444 component_specification_tag : component_specification_tag ,
445445 console_script : chunk_json_result [ "consoleReplayScript" ] ,
446446 render_options : render_options
447447 )
448+ else
449+ result_console_script = render_options . replay_console ? chunk_json_result [ "consoleReplayScript" ] : ""
450+ # No need to prepend component_specification_tag or add rails context again
451+ # as they're already included in the first chunk
452+ compose_react_component_html_with_spec_and_console (
453+ "" , chunk_json_result [ "html" ] , result_console_script
454+ )
448455 end
449-
450- result_console_script = render_options . replay_console ? chunk_json_result [ "consoleReplayScript" ] : ""
451- # No need to prepend component_specification_tag or add rails context again
452- # as they're already included in the first chunk
453- compose_react_component_html_with_spec_and_console (
454- "" , chunk_json_result [ "html" ] , result_console_script
455- )
456- end
457456 end
458457
459458 def build_react_component_result_for_server_rendered_hash (
@@ -688,3 +687,4 @@ def raise_missing_autoloaded_bundle(react_component_name)
688687end
689688# rubocop:enable Metrics/ModuleLength
690689# rubocop:enable Metrics/MethodLength
690+
0 commit comments