From 7c494cc631bd1a7b7e283f7f7d06a89e22489d4c Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 16 Sep 2019 17:27:19 +0100 Subject: [PATCH] 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 --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 069b3c097db..7940565ea5a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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