Skip to content

Commit 26a474e

Browse files
committed
fix the react railtie file watcher implementation
1 parent 12a944f commit 26a474e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/react/rails/railtie.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,13 @@ class Railtie < ::Rails::Railtie
3333
end
3434

3535
# Rails checks these objects for changes:
36-
app.reloaders << app.config.file_watcher.new([], reload_paths) {}
36+
react_reloader = app.config.file_watcher.new([], reload_paths) do
37+
React::ServerRendering.reset_pool
38+
end
39+
app.reloaders << react_reloader
40+
3741
# Reload renderers in dev when files change
38-
config.to_prepare { React::ServerRendering.reset_pool }
42+
config.to_prepare { react_reloader.execute_if_updated }
3943
end
4044

4145
# Include the react-rails view helper lazily

0 commit comments

Comments
 (0)