railsjazz / rails_live_reload

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

Fix "config.enabled" not working #35

Open alhajrahmoun opened 4 months ago

alhajrahmoun commented 4 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.