Skip to content

Commit

Permalink
Merge pull request #503 from natematykiewicz/disable_reload_in_produc…
Browse files Browse the repository at this point in the history
…tion

Disable code reloading in production by default
  • Loading branch information
allmarkedup authored Aug 30, 2023
2 parents 3845215 + 0c48855 commit f947d67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/src/_data/config_options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,10 @@ debugging:
system:
- name: reload_on_change
types: Boolean
default: "config.reload_classes_only_on_change"
default: "!config.cache_classes && config.reload_classes_only_on_change"
example: config.lookbook.reload_on_change = true
description: |
By default Lookbook uses the value of the `reload_classes_only_on_change` Rails config option to decide if
By default Lookbook uses the value of the `cache_classes` and `reload_classes_only_on_change` Rails config options to decide if
it should attempt to update the preview data after changes. If set the value of this config option will take precedence and be used instead.
- name: live_updates
Expand Down
4 changes: 3 additions & 1 deletion lib/lookbook/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ class Engine < Rails::Engine
ViewComponent::Preview.extend(Lookbook::PreviewAfterRender)
end

opts.reload_on_change = host_config.reload_classes_only_on_change if opts.reload_on_change.nil?
if opts.reload_on_change.nil?
opts.reload_on_change = !host_config.cache_classes && host_config.reload_classes_only_on_change
end
end

config.after_initialize do
Expand Down

0 comments on commit f947d67

Please sign in to comment.