storefront-api-examples
storefront-api-examples copied to clipboard
Support for Relay Modern
I've tried to use the Relay Modern pagination container, but it is not possible since in the API PageInfo
scheme is missing the endCursor
and startCursor
fields.. Any plan to add these to the Storefront API any time soon?
This seems like a bug in Relay Modern. The actual Relay spec doesn't say those fields are required: https://facebook.github.io/relay/graphql/connections.htm#sec-undefined.PageInfo.Fields
@swalkinshaw That's why I have opened an issue to the relay repo too, but I think the spec document is out of date. For example, Github API already supports this (see Github PageInfo schema type)
Glad you opened an issue. Here's a little more background: https://stackoverflow.com/a/34951162
@swalkinshaw that post has more than a year and a half, and given that Relay is quickly evolving I don't think is still valid. Every working example I've found on Relay Modern pagination uses endCursor
and startCursor
under PageInfo
.. Here a few examples:
- https://facebook.github.io/relay/docs/graphql-relay-specification.html
- https://stackoverflow.com/questions/44113029/relay-modern-load-more-is-not-working-hasmore-keep-returning-false
- http://www.persatuan-pangkas-rambut-garut.com/anggaran/dasar/ad.cgi/en/00/https/stackoverflow.com/questions/44321127/i-cannot-do-loadmore-in-relay-even-there-are-more-items
I think it would be awesome if you could provide a working example of pagination with Relay Modern in this repo. Meanwhile I hope to get a clarification on this matter from the Relay folks
If/when the official Relay spec is updated to include those fields, we'll add them as well.
I think it would be awesome if you could provide a working example of pagination with Relay Modern in this repo.
That isn't possible unless they remove the requirement of those fields right?
I'll leave this issue open to track the status of Relay.
@swalkinshaw is it still correct to assume Relay isn't compatible with the storefront api?
It still appears that way after a quick check.
I found https://github.com/facebook/relay/issues/2457 as well.
apollo-client
it is then! Thanks.
@swalkinshaw i think they have just updated official spec: https://github.com/facebook/relay/blob/83ad928200e3f484a5208884c6c7059609e880d1/website/spec/Connections.md#pageinfo-1
@swalkinshaw any updates on this?
+1
Hi Everyone,
I think now startCursor
and endCursor
is required. I am using relay version 11.0.2. And I am getting the following error.