Skip to content

Commit 67dcc23

Browse files
claudejustin808
authored andcommitted
Simplify ProUtils to return options directly
Refactor disable_pro_render_options_if_not_licensed to: - Return raw options directly instead of a hash - No longer track explicitly_disabled_pro_options - Silently disable pro-only options when Pro is not available This simplification removes the need to track which options were disabled, as we no longer display a warning badge. The method now only disables pro-only features silently, which is the desired behavior going forward.
1 parent 2daca1a commit 67dcc23

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

lib/react_on_rails/pro_utils.rb

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,23 @@ def self.support_pro_features?
1111
end
1212

1313
def self.disable_pro_render_options_if_not_licensed(raw_options)
14-
if support_pro_features?
15-
return {
16-
raw_options: raw_options,
17-
explicitly_disabled_pro_options: []
18-
}
19-
end
14+
return raw_options if support_pro_features?
2015

2116
raw_options_after_disable = raw_options.dup
2217

23-
explicitly_disabled_pro_options = PRO_ONLY_OPTIONS.select do |option|
24-
# Use global configuration if it's not overridden in the options
25-
next ReactOnRails.configuration.send(option) if raw_options[option].nil?
18+
PRO_ONLY_OPTIONS.each do |option|
19+
# Determine if this option is enabled (either explicitly or via global config)
20+
option_enabled = if raw_options[option].nil?
21+
ReactOnRails.configuration.send(option)
22+
else
23+
raw_options[option]
24+
end
2625

27-
raw_options[option]
26+
# Silently disable the option if it's enabled but Pro is not available
27+
raw_options_after_disable[option] = false if option_enabled
2828
end
29-
explicitly_disabled_pro_options.each { |option| raw_options_after_disable[option] = false }
3029

31-
{
32-
raw_options: raw_options_after_disable,
33-
explicitly_disabled_pro_options: explicitly_disabled_pro_options
34-
}
30+
raw_options_after_disable
3531
end
3632
end
3733
end

0 commit comments

Comments
 (0)