About
This tool shows the relationship between nullability and error handling in GraphQL, with specific respect to Apollo Client.
Set the toggles to see how the request / response will change. Scroll to the bottom to see the result!
Questions / Suggestions? Reach out to me at @mark_larah!
errorPolicy
to see how the response objects change. See docs.Player.name
field is nullable or not to see how the response objects change. See docs for errors and nullability.errorPolicy
attribute.const GET_BEST_PLAYER = gql`query {soccerTeam(name: "Manchester United") {player(shirtNumber: 9) {name}}}`;function MyComponent() {const result = useQuery(GET_BEST_PLAYER);const { data, error, loading } = result;return loading ? null: JSON.stringify({ data, error });}
Player.name
.type Player {name: StringshirtNumber: Intposition: String}type SoccerTeam {name: Stringplayer(shirtNumber: Int!): Player}type Query {soccerTeam(name: String!): SoccerTeam}
Player.name
.Player: {name(obj, args, context, info) {return 'Anthony Martial';}}
data
and error
(from MyComponent
- see above). Click the network tab in developer tools to poke about some more.{"loading": true}
@apollo/client@3.1.5