Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove duplicated attribute fetching in date and data time resolvers (#8810)
Filip Owczarek04c653e0cb5e
diff --git a/saleor/graphql/attribute/types.py b/saleor/graphql/attribute/types.pyindex 401f7b380e..5b47a7bbcc 100644--- a/saleor/graphql/attribute/types.py+++ b/saleor/graphql/attribute/types.py@@ -107,15 +107,29 @@ class AttributeValue(CountableDjangoObjectType):@staticmethoddef resolve_date_time(root: models.AttributeValue, info, **_kwargs):- if root.attribute.input_type == AttributeInputType.DATE_TIME:- return root.date_time- return None+ def _resolve_date(attribute):+ if attribute.input_type == AttributeInputType.DATE_TIME:+ return root.date_time+ return None++ return (+ AttributesByAttributeId(info.context)+ .load(root.attribute_id)+ .then(_resolve_date)+ )@staticmethoddef resolve_date(root: models.AttributeValue, info, **_kwargs):- if root.attribute.input_type == AttributeInputType.DATE:- return root.date_time- return None+ def _resolve_date(attribute):+ if attribute.input_type == AttributeInputType.DATE:+ return root.date_time+ return None++ return (+ AttributesByAttributeId(info.context)+ .load(root.attribute_id)+ .then(_resolve_date)+ )class AttributeValueCountableConnection(CountableConnection):