relayjs

How to get RelayJS to understand that a response from GraphQL is an array of items, not just a single item

ぐ巨炮叔叔 提交于 2019-11-29 09:35:28
问题 I have a GraphQL server running with a schema roughly like this: type Card { id: String! name: String } type Query { card(name: String!): Card cards(power: String): [Card] } Notice that I have a query on a single card, but also on multiple cards. When I use the GraphIQl UI and make a query like this "query {cards { name }}" I get back an array of cards, as expected. However, I have a RelayContainer that is making the same query, but the props that come back are just the first result, rather

In Relay, what role do the node interface and the global ID spec play?

徘徊边缘 提交于 2019-11-28 03:27:24
I started out with the relay-starter-kit and also worked my way through the Relay and GraphQL documentation. But there are quite a few areas that are unexplained and mysterious. Seriously I read a lot of documentations everywhere about all these things but couldn't find any satisfying explanations for the following questions: What is this for? I put logging but it never even gets called at all: var {nodeInterface, nodeField} = nodeDefinitions( (globalId) => { var {type, id} = fromGlobalId(globalId); if (type === 'User') { return getUser(id); } else if (type === 'Widget') { return getWidget(id)

In Relay, what role do the node interface and the global ID spec play?

谁都会走 提交于 2019-11-27 05:08:00
问题 I started out with the relay-starter-kit and also worked my way through the Relay and GraphQL documentation. But there are quite a few areas that are unexplained and mysterious. Seriously I read a lot of documentations everywhere about all these things but couldn't find any satisfying explanations for the following questions: What is this for? I put logging but it never even gets called at all: var {nodeInterface, nodeField} = nodeDefinitions( (globalId) => { var {type, id} = fromGlobalId