Skip to content

Commit

Permalink
PERF: Only invalidate other translations when en changes (#24443)
Browse files Browse the repository at this point in the history
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 eda7918
  • Loading branch information
davidtaylorhq committed Nov 18, 2023
1 parent 8c16482 commit 04a58a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/theme_field.rb
Expand Up @@ -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
Expand Down

1 comment on commit 04a58a6

@discoursebot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been mentioned on Discourse Meta. There might be relevant details there:

https://meta.discourse.org/t/fkb-pro-social-theme/234323/244

Please sign in to comment.