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 632daff commit 6c9b0ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Weblate 5.10.3

* Improved performance of API download endpoints.
* Reduced notifications overhead.
* Improved handling of components using :ref:`internal-urls`.

.. rubric:: Compatibility

Expand Down
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 6c9b0ce

Please sign in to comment.