From 2ad46d7bfaf0f948b89c1fc858b66b50c1fc80c8 Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Wed, 6 Sep 2023 16:04:12 +0530 Subject: [PATCH] fix: public issue list endpoint n+1 (#2099) --- apiserver/plane/api/views/issue.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apiserver/plane/api/views/issue.py b/apiserver/plane/api/views/issue.py index a390f7b81..d97b546d3 100644 --- a/apiserver/plane/api/views/issue.py +++ b/apiserver/plane/api/views/issue.py @@ -2100,6 +2100,12 @@ class ProjectIssuesPublicEndpoint(BaseAPIView): queryset=IssueReaction.objects.select_related("actor"), ) ) + .prefetch_related( + Prefetch( + "votes", + queryset=IssueVote.objects.select_related("actor"), + ) + ) .filter(**filters) .annotate(cycle_id=F("issue_cycle__cycle_id")) .annotate(module_id=F("issue_module__module_id"))