From e0181342c0d467406a1a0f04f03ae20c6eacfe8b Mon Sep 17 00:00:00 2001 From: Nikhil <118773738+pablohashescobar@users.noreply.github.com> Date: Mon, 17 Jul 2023 13:17:34 +0530 Subject: [PATCH] fix: n+1s (#1514) * dev: fix workspace n+1 * dev: trim down label details for issue state serializer --- apiserver/plane/api/serializers/issue.py | 2 +- apiserver/plane/api/views/workspace.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apiserver/plane/api/serializers/issue.py b/apiserver/plane/api/serializers/issue.py index 61958d89e..7aeee7d70 100644 --- a/apiserver/plane/api/serializers/issue.py +++ b/apiserver/plane/api/serializers/issue.py @@ -462,9 +462,9 @@ class IssueAttachmentSerializer(BaseSerializer): # Issue Serializer with state details class IssueStateSerializer(BaseSerializer): + label_details = LabelLiteSerializer(read_only=True, source="labels", many=True) state_detail = StateLiteSerializer(read_only=True, source="state") project_detail = ProjectLiteSerializer(read_only=True, source="project") - label_details = LabelSerializer(read_only=True, source="labels", many=True) assignee_details = UserLiteSerializer(read_only=True, source="assignees", many=True) sub_issues_count = serializers.IntegerField(read_only=True) bridge_id = serializers.UUIDField(read_only=True) diff --git a/apiserver/plane/api/views/workspace.py b/apiserver/plane/api/views/workspace.py index 4c136ed8c..305deb525 100644 --- a/apiserver/plane/api/views/workspace.py +++ b/apiserver/plane/api/views/workspace.py @@ -101,6 +101,7 @@ class WorkSpaceViewSet(BaseViewSet): .filter(workspace_member__member=self.request.user) .annotate(total_members=member_count) .annotate(total_issues=issue_count) + .select_related("owner") ) def create(self, request):