Skip to content

Commit 0fb9daa

Browse files
authored
Merge pull request #509 from github/eager-load-compile
Eager load compile
2 parents 57dc526 + bd128b6 commit 0fb9daa

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## master
44

5+
* Only compile components at application initialization if eager loading is enabled.
6+
7+
*Joel Hawksley*
8+
59
## 2.20.0
610

711
* Don't add `/test/components/previews` to preview_paths if directory doesn't exist.

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ GIT
8686
PATH
8787
remote: .
8888
specs:
89-
view_component (2.19.1)
89+
view_component (2.20.0)
9090
activesupport (>= 5.0.0, < 7.0)
9191

9292
GEM

lib/view_component/engine.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Engine < Rails::Engine # :nodoc:
4444

4545
initializer "view_component.eager_load_actions" do
4646
ActiveSupport.on_load(:after_initialize) do
47-
ViewComponent::Base.descendants.each(&:compile)
47+
ViewComponent::Base.descendants.each(&:compile) if Rails.application.config.eager_load
4848
end
4949
end
5050

0 commit comments

Comments
 (0)