Shopify/storefront-api-examples

Support for Relay Modern

Opened this issue · 12 comments

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:

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 facebook/relay#2457 as well.

apollo-client it is then! Thanks.

@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.

image