File tree Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Expand file tree Collapse file tree 4 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ class Railtie < ::Rails::Railtie
2424 config . react . view_helper_implementation = nil # Defaults to ComponentMount
2525
2626 # Watch .jsx files for changes in dev, so we can reload the JS VMs with the new JS code.
27- initializer "react_rails.add_watchable_files" , group : :all do |app |
27+ initializer "react_rails.add_watchable_files" , after : :load_config_initializers , group : :all do |app |
2828 # Watch files ending in `server_renderer_extensions` in each of `server_renderer_directories`
2929 reload_paths = config . react . server_renderer_directories . reduce ( { } ) do |memo , dir |
3030 app_dir = File . join ( app . root , dir )
Original file line number Diff line number Diff line change 1+ // used for testing file watcher configuration
Original file line number Diff line number Diff line change @@ -5,5 +5,10 @@ class CustomComponentMount < React::Rails::ComponentMount
55Dummy ::Application . configure do
66 config . react . addons = true
77 config . react . view_helper_implementation = CustomComponentMount
8+ # Add "app/pants" to the array we can test that file watchers are setup after
9+ # rails initializers are loaded
10+ config . react . server_renderer_directories = [ "/app/assets/javascripts/" ,
11+ "app/javascript" ,
12+ "app/pants" ]
813end
914
Original file line number Diff line number Diff line change 1+ require "test_helper"
2+
3+ class RailtieTest < ActionDispatch ::IntegrationTest
4+ test "reloaders are configured after initializers are loaded" do
5+ @test_file = File . expand_path ( "../../dummy/app/pants/yfronts.js" , File . dirname ( __FILE__ ) )
6+ FileUtils . touch @test_file
7+ results = Dummy ::Application . reloaders . map ( &:updated? )
8+ assert_includes ( results , true )
9+ end
10+ end
You can’t perform that action at this time.
0 commit comments