Can we force __typename
to be always present and not to be undefined
?
#423
-
Hi there! Using apollo client, the Thanks for your answer! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is explicitly not supported and In urql Graphcache, we actually adhere to The problem here is that while Apollo Client implicitly queries it, it's still an implicit selection that could be removed, i.e. if you look at what Graphcache does, it's technically more "correct" behaviour to adhere to the original selection, which is why we can't assume the field to be there. (A link also exists for Apollo afaik to actually remove the We don't really aim to introduce options for all possible implicit behaviour a GraphQL client may introduce, and instead opt to provide a correct and predictable default instead. |
Beta Was this translation helpful? Give feedback.
-
Alright. It might limit our adoption of gql.tada as it would require to update all our fragments and queries (even if it can be made little by little) but thanks for the detailed answer. I understand the point. |
Beta Was this translation helpful? Give feedback.
This is explicitly not supported and
__typename
is only included when fetching. Generally, we deem this more correct and an easily spottable error, since using it will immediately result in TS type errors.In urql Graphcache, we actually adhere to
__typename
inclusion, and Graphcache will reselect each selection, omitting__typename
if it isn't included.The problem here is that while Apollo Client implicitly queries it, it's still an implicit selection that could be removed, i.e. if you look at what Graphcache does, it's technically more "correct" behaviour to adhere to the original selection, which is why we can't assume the field to be there. (A link also exists for Apollo afaik to act…