You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I'm having problems with the dataloaders in a project where I use strawberry for the subscriptions and Graphene for the mutations and queries. The problem is that I'm trying to use the 'then' inside a resolver but raise an error: "'SyncFuture' object has no attribute 'then'".
Explanation
The resolver is:
def resolve_creator(self, info):
if not self.creator:
return None
if hasattr(info.context, "loaders"):
return info.context.loaders.user_community_loader.load(
self.creator_id
).then(lambda user: user)
return self.creator
The loader was charged inside the info context self.user_community_loader = SyncDataLoader(user_community_load)
And the user community load follows your example:
def user_community_load(keys: List[int]) -> List[UserCommunity]:
qs = UserCommunity.objects.filter(id__in=keys)
user_map = {user.id: user for user in qs}
return [user_map.get(key, None) for key in keys]
Hello, I'm having problems with the dataloaders in a project where I use strawberry for the subscriptions and Graphene for the mutations and queries. The problem is that I'm trying to use the 'then' inside a resolver but raise an error: "'SyncFuture' object has no attribute 'then'".
Explanation
The resolver is:
The loader was charged inside the info context
self.user_community_loader = SyncDataLoader(user_community_load)
And the user community load follows your example:
Requirements
If you have any idea of why is this error raising please let me know, thanks a lot
The text was updated successfully, but these errors were encountered: