From 239b70342fb7298686d30ca384870070048b435f Mon Sep 17 00:00:00 2001 From: Alan Guo Xiang Tan Date: Tue, 19 Mar 2024 04:03:49 +0800 Subject: [PATCH] PERF: Remove unnecessary for theme javascript (#26220) This is a follow up to e2da72b76c7f49c2c3a159ce48051c4050f3dc3e. Why this change? According to https://web.dev/articles/preload-critical-assets, > By preloading a certain resource, you are telling the browser that you would like to fetch it sooner than the browser would otherwise discover it because you are certain that it is important for the current page. The preload resource hint is meant to tell the browser to fetch resources that it would not discover upfront or early. However, we are not using it the right way because we are literally adding the resource hint right before a ` HTML end diff --git a/app/models/theme_field.rb b/app/models/theme_field.rb index 38dc09d28f6..5387c9a79da 100644 --- a/app/models/theme_field.rb +++ b/app/models/theme_field.rb @@ -191,7 +191,6 @@ class ThemeField < ActiveRecord::Base javascript_cache.save! doc.add_child(<<~HTML.html_safe) if javascript_cache.content.present? - HTML [doc.to_s, errors&.join("\n")] @@ -300,7 +299,6 @@ class ThemeField < ActiveRecord::Base javascript_cache.save! doc = "" doc = <<~HTML.html_safe if javascript_cache.content.present? - HTML [doc, errors&.join("\n")]