Closed maraisr closed 2 years ago
@n1ru4l You are familiar with Relay, can you help take a look?
I remmeber this - I ported the behavior from graphql-js https://github.com/graphql/graphql-relay-js/issues/243
The reason cursors are nullable is because it's unclear what they should be when array is empty. But if array is empty, we can still get information about whether there is next page. So I am not sure that returning null for PageInfo is correct when array.length === 0
The spec clearly says the cursors must be non-null, see link I attached in pr description.
The field is aptly named "PageInfo" alluding to the fact it's information about a page, if there is no page — aka edges is empty — then the field (PageInfo) is null.
There is chatter about the repo you linked "graphql-relay-js" so still waiting on an official answer.
For now, maybe our best bet is to check what our c# friends are doing with HotChocolate.
Closing this as all other relay implementations do the same
Just because they all do the same, doesn't make it right.
PageInfo is a nullable entity, making all members NonNull please see https://relay.dev/graphql/connections.htm#sec-undefined.PageInfo.Fields