File tree Expand file tree Collapse file tree 4 files changed +11
-9
lines changed
Expand file tree Collapse file tree 4 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -381,7 +381,7 @@ def rails_context(server_side: true)
381381 if ReactOnRails ::Utils . react_on_rails_pro?
382382 result [ :rorProVersion ] = ReactOnRails ::Utils . react_on_rails_pro_version
383383
384- result [ :rscPayloadGenerationUrlPath ] = rsc_url if ReactOnRailsPro . configuration . enable_rsc_support
384+ result [ :rscPayloadGenerationUrlPath ] = rsc_url if ReactOnRails :: Utils . rsc_support_enabled?
385385 end
386386
387387 if defined? ( request ) && request . present?
Original file line number Diff line number Diff line change @@ -89,8 +89,7 @@ def client_entrypoint?(file_path)
8989
9090 def pack_file_contents ( file_path )
9191 registered_component_name = component_name ( file_path )
92- load_server_components = ReactOnRails ::Utils . react_on_rails_pro? &&
93- ReactOnRailsPro . configuration . enable_rsc_support
92+ load_server_components = ReactOnRails ::Utils . rsc_support_enabled?
9493
9594 if load_server_components && !client_entrypoint? ( file_path )
9695 return <<~FILE_CONTENT . strip
@@ -142,8 +141,7 @@ def generated_server_pack_file_content
142141 "import #{ name } from '#{ relative_path ( generated_server_bundle_file_path , component_path ) } ';"
143142 end
144143
145- load_server_components = ReactOnRails ::Utils . react_on_rails_pro? &&
146- ReactOnRailsPro . configuration . enable_rsc_support
144+ load_server_components = ReactOnRails ::Utils . rsc_support_enabled?
147145 server_components = component_for_server_registration_to_path . keys . delete_if do |name |
148146 next true unless load_server_components
149147
Original file line number Diff line number Diff line change @@ -213,6 +213,13 @@ def self.react_on_rails_pro_version
213213 end
214214 end
215215
216+ def self . rsc_support_enabled?
217+ return false unless react_on_rails_pro?
218+
219+ rorp_config = ReactOnRailsPro . configuration
220+ rorp_config . respond_to? ( :enable_rsc_support ) && rorp_config . enable_rsc_support
221+ end
222+
216223 def self . full_text_errors_enabled?
217224 ENV [ "FULL_TEXT_ERRORS" ] == "true"
218225 end
Original file line number Diff line number Diff line change @@ -220,10 +220,7 @@ def self.configuration
220220 before do
221221 stub_packer_source_path ( component_name : components_directory ,
222222 packer_source_path : packer_source_path )
223- allow ( ReactOnRails ::Utils ) . to receive ( :react_on_rails_pro? ) . and_return ( true )
224- allow ( ReactOnRailsPro . configuration ) . to receive_messages (
225- enable_rsc_support : true
226- )
223+ allow ( ReactOnRails ::Utils ) . to receive_messages ( react_on_rails_pro? : true , rsc_support_enabled? : true )
227224 end
228225
229226 context "when common component is not a client entrypoint" do
You can’t perform that action at this time.
0 commit comments