Skip to content

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

Use PrefetchingConnectionField as base class for FilterInputConnectionField

Krzysztof Świąteke7882ef1c63c
diff --git a/saleor/graphql/core/connection.py b/saleor/graphql/core/connection.py
index 92375e0366..031432cfa1 100644
--- a/saleor/graphql/core/connection.py
+++ b/saleor/graphql/core/connection.py
@@ -68,7 +68,7 @@ def connection_from_queryset_slice(
has_previous_page = False
has_next_page = False
if previous_page_margin:
- has_previous_page = len(matching_records > 0)
+ has_previous_page = len(matching_records) > 0
matching_records = matching_records[previous_page_margin:]
if requested_count is not None:
has_next_page = len(matching_records) > requested_count
diff --git a/saleor/graphql/core/fields.py b/saleor/graphql/core/fields.py
index 3c34e778f2..db1481138e 100644
--- a/saleor/graphql/core/fields.py
+++ b/saleor/graphql/core/fields.py
@@ -107,7 +107,7 @@ class PrefetchingConnectionField(BaseDjangoConnectionField):
return connection
-class FilterInputConnectionField(BaseDjangoConnectionField):
+class FilterInputConnectionField(PrefetchingConnectionField):
def __init__(self, *args, **kwargs):
self.filter_field_name = kwargs.pop("filter_field_name", "filter")
self.filter_input = kwargs.get(self.filter_field_name)