Skip to content

Commit bd0734d

Browse files
committed
Add immediate_hydration_config helper to ProUtils
Add a helper method to access the immediate_hydration configuration from ReactOnRailsPro when Pro is available. Changes: - Add immediate_hydration_config class method that returns false when Pro is not available, or ReactOnRailsPro.configuration. immediate_hydration when Pro is available - Update disable_pro_render_options_if_not_licensed to use the new helper instead of accessing ReactOnRails.configuration This prepares for removing immediate_hydration from ReactOnRails configuration.
1 parent f6b0f5d commit bd0734d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/react_on_rails/pro_utils.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ def self.support_pro_features?
1010
ReactOnRails::Utils.react_on_rails_pro?
1111
end
1212

13+
# Returns the immediate_hydration configuration value
14+
# @return [Boolean] immediate_hydration setting from Pro config if Pro is available, false otherwise
15+
def self.immediate_hydration_config
16+
return false unless support_pro_features?
17+
18+
ReactOnRailsPro.configuration.immediate_hydration
19+
end
20+
1321
def self.disable_pro_render_options_if_not_licensed(raw_options)
1422
return raw_options if support_pro_features?
1523

@@ -18,7 +26,8 @@ def self.disable_pro_render_options_if_not_licensed(raw_options)
1826
PRO_ONLY_OPTIONS.each do |option|
1927
# Determine if this option is enabled (either explicitly or via global config)
2028
option_enabled = if raw_options[option].nil?
21-
ReactOnRails.configuration.send(option)
29+
# Use the Pro config helper to get the global config value
30+
immediate_hydration_config
2231
else
2332
raw_options[option]
2433
end

0 commit comments

Comments
 (0)