Incompatibility between Error Union guidance and Connections spec
- Dominant language
- Rust
- Stars
- 19k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
Hi!
Per the guidance at https://relay.dev/docs/guided-tour/rendering/error-states/#accessing-errors-in-graphql-responses, it is recommended to use the error union pattern to surface errors to the UX.
Besides being a great pattern in general, in that it forces developers to handle errors, it is especially important in Relay given that Relay swallows errors if returned query `data` is not empty.
However, using this pattern seems to make it impossible to use Relay connection based pagination - one of the key benefits of Relay.
The spec (https://relay.dev/graphql/connections.htm) does not make allowance for union types on connection fields.
Further, the Relay compiler likewise errors when defining a union as a field type for a connection field, return `The type has no field edges.
See https://relay.dev/docs/error-reference/unknown-field/`
Can you advise on how to resolve this compatibility? It's not clear how complex this would be, but given the above mentioned swallowing of errors, it would seem the ideal solution would be to allow the Relay compiler to allow unions.
Contributor guide
Assessment
This issue has not been assessed yet.