-
Notifications
You must be signed in to change notification settings - Fork 3
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
chore: increase documentation across the codebase #503
base: master
Are you sure you want to change the base?
Conversation
* simplify example folder
* setup now returns the created config
Co-authored-by: Elliot Milco <[email protected]>
…source into documentation
🙌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks Gino! I struggle every time I have to traverse code that uses this, very helpful for me!
|
||
## What is a Node? | ||
|
||
A `Node` is a refetchable GraphQL resource. All `Node`s must have a _globally unique ID_ and be fetchable via this ID. Relay will refetch these resources in the following way: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: maybe reference the gql interface, perhaps even update the code snippet below such that Foo implements Node
? The Node
interface is the fundamental part, right? it's the smart impl that's the magic?
* first. | ||
* | ||
* Even if multiple fields use the `createResolve` helper, there will only | ||
* be one network request as the requests will be batched via a DataLoader. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: there needs to be batch-compliant endpoints on the backing api to support, right? does the example api need to call that out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never answered this but that is orthogonal to the createResolve
helper. What you are talking about is the DataLoader that is by default used in the HttpApi class.
That is a good point though and dataloading should be the next portion.
'/graphql', | ||
graphqlHTTP({ | ||
schema: new GraphQLSchema({ query: Query }), | ||
graphiql: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: I havent used this in a while! adding the playground (if you need it) is pretty simple (middleware)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite understand what this does? Currently the GraphiQL Playground is being hosted and accessible via localhost when running yarn start
.
|
||
The [NodeType](./src/types/NodeType.ts#) class does two things: | ||
1. it defines the `Node` type required by Relay | ||
1. it implements a solution to asynchronously resolve the Node by fetching it from a backing REST API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: just want to make sure I understanding the semantics clearly, this is most likely just me making noise...
- does it define the
Node
or does it provide the concrete implementation for aNode
in the relay sense? - the solution is just an implementation of the relay gql interface that's got some smarts, right? provides implementation for
node
,nodes
by asynchronously fetching...?
} | ||
``` | ||
|
||
## The Node Class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: this is kind of ambiguous to me, should I be reading this something like, "The NodeType, a sensible Node Implementation"?
This PR aims to provide meaningful documentation on this library. This comes in three forms: