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
If you construct a query that only contains a spread fragment, it appears that the resolver's root argument becomes null. This only happens whenever there are no other fields being queried, only the fragment.
The following is the resolver for the organizations field:
letorganizationField(organizationType:OutputDef<Organization>)=
Define.AsyncField("organization",
Nullable organizationType,"Gets one of the user's organizations by id",[ Define.Input("id", StringType)],fun ctx (root: Root)->letglobalId= ctx.Arg<string>"id"match globalId with| GlobalId("Organization", id)->letrepository= buildOrganizationRepository root.Db root.UserId
repository.Fetch(Guid(id))|_-> raise (GQLMessageException "Invalid organization ID received."))
And the root is a simple record value:
typeRoot={
Db:DbCtx
UserId:string}
If the query is executed against this setup, then the root argument of the resolver becomes null, even when that is not a valid value
for the field. This issue completely goes away whenever there is either another field in the main query, as in the following:
Description
If you construct a query that only contains a spread fragment, it appears that the resolver's root argument becomes null. This only happens whenever there are no other fields being queried, only the fragment.
Repro steps
The following is an example of such a query:
The following is the resolver for the organizations field:
And the root is a simple record value:
If the query is executed against this setup, then the root argument of the resolver becomes null, even when that is not a valid value
for the field. This issue completely goes away whenever there is either another field in the main query, as in the following:
Or the fragment is not used, and instead is sent inline as normal:
Expected behavior
The organizations field should be the same for all of the previous queries, and no null error should occur.
Actual behavior
The root argument is null.
Known workarounds
Add a dummy field to the main query, as that somehow makes the root field not be null.
Related information
The text was updated successfully, but these errors were encountered: