class ReactOnRails::ReactComponent::RenderOptions
Constants
- NO_PROPS
Attributes
Public Class Methods
Source
# File lib/react_on_rails/react_component/render_options.rb, line 15 def initialize(react_component_name: required("react_component_name"), options: required("options")) @react_component_name = react_component_name.camelize @options = options end
TODO: remove the required for named params
Public Instance Methods
Source
# File lib/react_on_rails/react_component/render_options.rb, line 74 def auto_load_bundle retrieve_configuration_value_for(:auto_load_bundle) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 30 def client_props props_extension = ReactOnRails.configuration.rendering_props_extension if props_extension.present? if props_extension.respond_to?(:adjust_props_for_client_side_hydration) return props_extension.adjust_props_for_client_side_hydration(react_component_name, props.clone) end raise ReactOnRails::Error, "ReactOnRails: your rendering_props_extension module is missing the " \ "required adjust_props_for_client_side_hydration method & can not be used" end props end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 48 def dom_id @dom_id ||= options.fetch(:id) do if random_dom_id generate_unique_dom_id else base_dom_id end end end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 98 def force_load retrieve_configuration_value_for(:force_load) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 66 def html_options options[:html_options].to_h end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 106 def internal_option(key) options[key] end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 94 def logging_on_server retrieve_configuration_value_for(:logging_on_server) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 70 def prerender retrieve_configuration_value_for(:prerender) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 26 def props options.fetch(:props) { NO_PROPS } end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 90 def raise_non_shell_server_rendering_errors retrieve_react_on_rails_pro_config_value_for(:raise_non_shell_server_rendering_errors) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 86 def raise_on_prerender_error retrieve_configuration_value_for(:raise_on_prerender_error) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 44 def random_dom_id retrieve_configuration_value_for(:random_dom_id) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 58 def random_dom_id? return false if options[:id] return false unless random_dom_id true end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 82 def replay_console retrieve_configuration_value_for(:replay_console) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 110 def set_option(key, value) options[key] = value end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 114 def stream? options[:stream?] end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 22 def throw_js_errors options.fetch(:throw_js_errors, false) end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 102 def to_s "{ react_component_name = #{react_component_name}, options = #{options}, request_digest = #{request_digest}" end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 78 def trace retrieve_configuration_value_for(:trace) end
Private Instance Methods
Source
# File lib/react_on_rails/react_component/render_options.rb, line 122 def base_dom_id "#{react_component_name}-react-component" end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 126 def generate_unique_dom_id "#{base_dom_id}-#{SecureRandom.uuid}" end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 130 def retrieve_configuration_value_for(key) options.fetch(key) do ReactOnRails.configuration.public_send(key) end end
Source
# File lib/react_on_rails/react_component/render_options.rb, line 136 def retrieve_react_on_rails_pro_config_value_for(key) options.fetch(key) do return nil unless ReactOnRails::Utils.react_on_rails_pro? ReactOnRailsPro.configuration.public_send(key) end end