Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Relay Notes
- Define a schema, that is used for _both_ server side endpoint setup & frontend graphql compilation
- node only for now, some graphql ports
- Relay has a strict specification of how a graphql schema is set up:
- tree children are called "plural links" (see _writePluralLink())
Bad points
- Complex, many new concepts
- Proprietary format
- Reminds me of (the bad points about) SOAP, RequestFactory
- Errors are returned as 200
- No tracebacks if a serverside exception occurs (with graphqllib)
- Error reporting in general isn't the greatest: "null parameter: AttributeError: 'AttributeError' object has no attribute 'message'" with graphqllib
- GraphQLError wrappers hide tracebacks
- errors: null, errors: [] both raise errors on the client
- Root query args must be string, otherwise get some weird invariant violation
- finding answers to q's is hard, a fledgling community
- specifying fragments is hard with mutations & composition
- input into a mutation must be relay output
- optimistic responses must have an id
- optional args must be declared, and must be null
- IMPORTANT: Components can only see the data they queried. If you have child objects that have a field used for keys, make sure to include that field in the query fragment
- And don't be cloning relay props neither, they are of a certain type
- Some operations don't diff properly, eg delete from children, so need to fudge parent field (add a space for eg) in order to make the diff work
Django integration possibilities
- Existing need due for isomorphic react apps
- exec node script, call python from node with node-python npm package
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment