Skip to content

Commit

Permalink
fix: optimize fetching linked components for links
Browse files Browse the repository at this point in the history
The link cannot have linked components, so avoid fetching it from the
database.

Fixes WEBLATE-27QC
  • Loading branch information
nijel committed Feb 28, 2025
1 parent 4160fa9 commit bf43865
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions weblate/trans/models/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,8 @@ def get_repo_link_url(self):
@cached_property
def linked_childs(self) -> ComponentQuerySet:
"""Return list of components which links repository to us."""
if self.is_repo_link:
return self.component_set.none()
children = self.component_set.prefetch()
for child in children:
child.linked_component = self
Expand Down

0 comments on commit bf43865

Please sign in to comment.