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
we are finding ourselves to understand how it is possible to remove null data in list in the result.
For instance, given the schema of a user, where the user is inside a list of users.data
@strawberry.type
class User:
id: int
name: str
We are searching the user in the subfields exploiting the dataloaders and not resolving the entire users in the user resolver.
def resolve_user(info: strawberry.Info, filters) -> str: <-- this is just propagating the ids to the sub type
return filters.ids <-- [1,2,3,9999]
def resolve_name(root: "User", info: strawberry.Info) -> str:
return dataloader.load(root.id).name
I want the users [1,2,3,9999].
What happen is while resolving the name of user 9999 the user is not found and we have nothing to assign to the relative name throwing an error because name can not be null. The error is propagated upper and we nullify the entire user.
Our result is [user 1, user 2, user 3, null].
Is there a way in strawberry to remove the null in the returned list? How is it possible to act in a post process like that?
Thanks
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
Dear,
we are finding ourselves to understand how it is possible to remove null data in list in the result.
For instance, given the schema of a user, where the user is inside a list of users.data
We are searching the user in the subfields exploiting the dataloaders and not resolving the entire users in the user resolver.
I want the users [1,2,3,9999].
What happen is while resolving the name of user 9999 the user is not found and we have nothing to assign to the relative name throwing an error because name can not be null. The error is propagated upper and we nullify the entire user.
Our result is [user 1, user 2, user 3, null].
Is there a way in strawberry to remove the null in the returned list? How is it possible to act in a post process like that?
Thanks
Upvote & Fund
The text was updated successfully, but these errors were encountered: