File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed
actionview/lib/action_view Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,17 @@ def initialize(watcher:, &block)
10
10
@watcher = nil
11
11
@previous_change = false
12
12
13
- rebuild_watcher
14
-
15
13
ActionView ::PathRegistry . file_system_resolver_hooks << method ( :rebuild_watcher )
16
14
end
17
15
18
16
def updated?
17
+ build_watcher unless @watcher
19
18
@previous_change || @watcher . updated?
20
19
end
21
20
22
21
def execute
22
+ return unless @watcher
23
+
23
24
watcher = nil
24
25
@mutex . synchronize do
25
26
@previous_change = false
@@ -33,7 +34,7 @@ def reload!
33
34
ActionView ::LookupContext ::DetailsKey . clear
34
35
end
35
36
36
- def rebuild_watcher
37
+ def build_watcher
37
38
@mutex . synchronize do
38
39
old_watcher = @watcher
39
40
@@ -51,6 +52,11 @@ def rebuild_watcher
51
52
end
52
53
end
53
54
55
+ def rebuild_watcher
56
+ return unless @watcher
57
+ build_watcher
58
+ end
59
+
54
60
def dirs_to_watch
55
61
all_view_paths . uniq . sort
56
62
end
Original file line number Diff line number Diff line change @@ -116,7 +116,6 @@ class Railtie < Rails::Engine # :nodoc:
116
116
view_reloader = ActionView ::CacheExpiry ::ViewReloader . new ( watcher : app . config . file_watcher )
117
117
118
118
app . reloaders << view_reloader
119
- view_reloader . execute
120
119
app . reloader . to_run do
121
120
require_unload_lock!
122
121
view_reloader . execute
You can’t perform that action at this time.
0 commit comments