DEV: Live-reloading of core/plugin CSS alongside preview_theme_id

In development, we track the last requested theme id, and use that to refresh the correct stylesheet targets. The after_action hook runs on every request, but the preview_theme_id parameter is only sent on the initial HTML request. This commit ensures we only fetch the development theme_id on HTML requests
This commit is contained in:
David Taylor 2019-09-16 17:27:19 +01:00
parent 1de5d10f61
commit 7c494cc631
1 changed files with 1 additions and 1 deletions

View File

@ -64,7 +64,7 @@ class ApplicationController < ActionController::Base
after_action :remember_theme_id
def remember_theme_id
if @theme_ids.present?
if @theme_ids.present? && request.format == "html"
Stylesheet::Watcher.theme_id = @theme_ids.first if defined? Stylesheet::Watcher
end
end