PERF: Don't serialize value for theme_fields unnecessarily (#21201)

The value field of ThemeField is only used when viewing a diff in the staff action logs and local theme editing. value is being serialized into the theme index as well, which is not used. It's a huge amount of JSON that we can cut by removing it.

This also breaks up the various theme serializers into separate classes so they autoload properly (or at least restart the server on edit)
This commit is contained in:
Mark VanLandingham
2023-04-24 09:30:51 -05:00
committed by GitHub
parent 599979902e
commit 012aaf0ba3
8 changed files with 115 additions and 84 deletions

View File

@ -27,4 +27,16 @@ describe "Admin Customize Themes", type: :system, js: true do
expect(theme.reload.color_scheme_id).to eq(color_scheme.id)
end
end
describe "when editing a local theme" do
it "The saved value is present in the editor" do
theme.set_field(target: "common", name: "head_tag", value: "console.log('test')", type_id: 0)
theme.save!
visit("/admin/customize/themes/#{theme.id}/common/head_tag/edit")
ace_content = find(".ace_content")
expect(ace_content.text).to eq("console.log('test')")
end
end
end