railsjazz / rails_live_reload

Live Reload for your Rails app. The easiest way to increase your productivity.
https://www.railsjazz.com/
MIT License
341 stars 9 forks source link

Fix "config.enabled" not working #35

Open alhajrahmoun opened 6 months ago

alhajrahmoun commented 6 months ago

This is a proposed fix for #26.

The RailsLiveReload.enabled? check is currently performed immediately when the Railtie class is interpreted, returning true since it's the default value. However, due to the Rails application lifecycle, the state of RailsLiveReload.enabled? will change by the time the initializers are run and it will return the value specified in the rails app initializer.

I tried moving the RailsLiveReload.enabled? check into each initializer block and it seems to be fixing the issue.