Skip to content

Commit

Permalink
Fix: Queryset evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
arunsureshkumar committed May 6, 2023
1 parent d1d60b9 commit 60f2273
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion graphene_mongo/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def default_resolver(self, _root, info, required_fields=None, resolved=None, **a
if count:
has_next_page = True if (0 if limit is None else limit) + (0 if skip is None else skip) < count else False
else:
if isinstance(queryset, QuerySet):
if isinstance(queryset, QuerySet) and iterables:
has_next_page = bool(queryset(pk__gt=iterables[-1].pk).limit(1).first())
else:
has_next_page = False
Expand Down
6 changes: 4 additions & 2 deletions graphene_mongo/fields_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ async def default_resolver(self, _root, info, required_fields=None, resolved=Non
if count:
has_next_page = True if (0 if limit is None else limit) + (0 if skip is None else skip) < count else False
else:
if isinstance(queryset, QuerySet):
if isinstance(queryset, QuerySet) and iterables:
has_next_page = bool(await sync_to_async(queryset(pk__gt=iterables[-1].pk).limit(1).first,
thread_sensitive=False,
executor=ThreadPoolExecutor())())
Expand Down Expand Up @@ -331,7 +331,9 @@ async def connection_resolver(cls, resolver, connection_type, root, info, **args
setattr(root, key, from_global_id(value)[1])
except Exception:
pass
iterable = await resolver(root, info, **args)

iterable = await resolver(root=root, info=info, **args)

if isinstance(connection_type, graphene.NonNull):
connection_type = connection_type.of_type
on_resolve = partial(cls.resolve_connection, connection_type, args)
Expand Down

0 comments on commit 60f2273

Please sign in to comment.