File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
dummy/config/initializers Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ class Railtie < ::Rails::Railtie
25
25
end
26
26
27
27
# Include the react-rails view helper lazily
28
- initializer "react_rails.setup_view_helpers" , group : :all do |app |
28
+ initializer "react_rails.setup_view_helpers" , after : :load_config_initializers , group : :all do |app |
29
29
30
30
app . config . react . jsx_transformer_class ||= React ::JSX ::DEFAULT_TRANSFORMER
31
31
React ::JSX . transformer_class = app . config . react . jsx_transformer_class
@@ -53,7 +53,7 @@ class Railtie < ::Rails::Railtie
53
53
end
54
54
end
55
55
56
- initializer "react_rails.bust_cache" , group : :all do |app |
56
+ initializer "react_rails.bust_cache" , after : :load_config_initializers , group : :all do |app |
57
57
asset_variant = React ::Rails ::AssetVariant . new ( {
58
58
variant : app . config . react . variant ,
59
59
addons : app . config . react . addons ,
Original file line number Diff line number Diff line change 1
1
# Override setting set in application.rb
2
- Rails . application . config . react . addons = true
2
+ class CustomComponentMount < React ::Rails ::ComponentMount
3
+ end
4
+
5
+ Dummy ::Application . configure do
6
+ config . react . addons = true
7
+ config . react . view_helper_implementation = CustomComponentMount
8
+ end
9
+
Original file line number Diff line number Diff line change @@ -17,4 +17,11 @@ class ViewHelperTest < ActionView::TestCase
17
17
render template : "pages/show"
18
18
assert_includes ( rendered , "React-Rails" )
19
19
end
20
+
21
+ test "view helper uses the implementation class set in the initializer" do
22
+ assert_equal (
23
+ React ::Rails ::ViewHelper . helper_implementation_class . to_s ,
24
+ "CustomComponentMount"
25
+ )
26
+ end
20
27
end
You can’t perform that action at this time.
0 commit comments