From 04a58a6e64b39c567b1fda6618f20e7b72a546ec Mon Sep 17 00:00:00 2001 From: David Taylor Date: Sat, 18 Nov 2023 12:36:25 +0000 Subject: [PATCH] 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 eda79186eefaf97fe916d97c256c3e7b807d2237 --- app/models/theme_field.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/theme_field.rb b/app/models/theme_field.rb index 53e2d4a896c45..8173d49e49283 100644 --- a/app/models/theme_field.rb +++ b/app/models/theme_field.rb @@ -664,8 +664,8 @@ def dependent_fields 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