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
It's not part of the spec but it makes working with GraphQL queries as a client much easier.
A lot of the code I write looks like foo.unwrap().bar.baz.unwrap().bam.unwrap() - it's a pain to work with the query response because we have to handle the nullability manually.
@required is a client directive that essentially says "if this field is null, throw an error". This is essentially the same as writing .unwrap() everywhere - except that the macro can handle it for us.
This would greatly simplify the development process for cases where we know something can never be null, even if the query types don't show it.
The text was updated successfully, but these errors were encountered:
https://relay.dev/docs/guides/required-directive/
It's not part of the spec but it makes working with GraphQL queries as a client much easier.
A lot of the code I write looks like
foo.unwrap().bar.baz.unwrap().bam.unwrap()
- it's a pain to work with the query response because we have to handle the nullability manually.@required
is a client directive that essentially says "if this field is null, throw an error". This is essentially the same as writing.unwrap()
everywhere - except that the macro can handle it for us.This would greatly simplify the development process for cases where we know something can never be null, even if the query types don't show it.
The text was updated successfully, but these errors were encountered: