Created
February 28, 2017 01:19
-
-
Save shangxiao/b37b165ceecc61e1d3ae10cb38733fef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: https://facebook.github.io/relay/docs/graphql-relay-specification.html | |
- 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 | |
Gotchas | |
------- | |
- 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 | |
- | |
Links | |
----- | |
- https://facebook.github.io/react/blog/2015/03/19/building-the-facebook-news-feed-with-relay.html | |
- http://blog.startifact.com/posts/the-emerging-graphql-python-stack.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment