PERF: Only invalidate other translations when en changes (#24443)

en is the only fallback locale we use, so there's no need to invalidate everything when other languages change. Limiting this also helps to prevent circular dependent_field relations which could cause issues in some situations.

Followup to eda79186ee
This commit is contained in:
David Taylor 2023-11-18 12:36:25 +00:00 committed by GitHub
parent 8c16482932
commit 04a58a6e64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -664,8 +664,8 @@ class ThemeField < ActiveRecord::Base
name: ThemeField.scss_fields + ThemeField.html_fields,
)
)
elsif translation_field?
return theme.theme_fields.where(target_id: Theme.targets[:translations])
elsif translation_field? && name == "en" # en is fallback for all other locales
return theme.theme_fields.where(target_id: Theme.targets[:translations]).where.not(name: "en")
end
ThemeField.none
end