Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Optimize queries

IKarbowiakc24f7e3fc75f
diff --git a/saleor/graphql/account/types.py b/saleor/graphql/account/types.py
index b021d7b29f..3d3e0f7109 100644
--- a/saleor/graphql/account/types.py
+++ b/saleor/graphql/account/types.py
@@ -440,10 +440,12 @@ class Group(CountableDjangoObjectType):
only_fields = ["name", "permissions", "users", "id"]
@staticmethod
+ @gql_optimizer.resolver_hints(prefetch_related="user_set")
def resolve_users(root: auth_models.Group, _info):
return root.user_set.all()
@staticmethod
+ @gql_optimizer.resolver_hints(prefetch_related="permissions")
def resolve_permissions(root: auth_models.Group, _info):
permissions = root.permissions.prefetch_related("content_type").order_by(
"codename"