-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
List of connections don't seem to be supported correctly #843
Comments
@KyleAMathews Can you paste the relevant portion of the query and schema? |
query:
schema:
|
Which field is the list of connections? That just looks like a normal collection (?). |
In graphql-js, I create it with |
Got it, i see it in the schema now. You're correct that Relay has a heuristic for detecting connections - it's based on the type name (ends in "Connection"), the existence of connection-like fields, and the presence of edges and page info fields. Relay also assumes that connection fields are scalars, so if you need a list of them, you might have to create an intermediate object in the schema:
|
K, closing this as "works as expected". Thanks! |
Cool, thanks for following up here. |
Does Relay have a heuristic for detecting type names that end in "Item"? |
I don't think so, @jeromecovington. Generally heuristics aren't fun. The |
You're right @wincent - testing in my current app seems to confirm no magic "Item". |
I'm working on adding a new field to GraphQL that is a list of connections. It works perfectly when queried from GraphiQL but when I do the same query in Relay I get this error:
Followed by:
Relay seems to be assuming the list is the actual connection and is looking for a
edges
field (which is correctly set on the items in the list).UPDATE:
So played around some more and if I remove the connection arguments (first/last/etc) from the list field then it starts working. So Relay has I'm assuming a heuristic for connections which looks for certain arguments and then treats the field as a connection. This makes this case a bit awkward as I want to be able to pass normal connection arguments to each of the child connections in the list. The simplest work-around here is probably to just use different argument names and then rewrite for passing to the next layer.
Is this something Relay core should fix or just ignore for now as it's a fairly edgy edge case?
The text was updated successfully, but these errors were encountered: