-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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(docs): Fix docs starting with n #19065
Conversation
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.
Thank you so much for doing this!
Left a couple of comments
@@ -2,13 2,13 @@ | |||
title: Node Creation | |||
--- | |||
|
|||
Nodes are created by calling the [createNode](/docs/actions/#createNode) action. Nodes can be any object. | |||
Calling the [createNode](/docs/actions/#createNode) action creates nodes. Which can be any object. |
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.
Calling the [createNode](/docs/actions/#createNode) action creates nodes. Which can be any object. | |
Calling the [createNode](/docs/actions/#createNode) action creates Node objects. |
|
||
A node is stored in redux under the `nodes` namespace, whose state is a map of the node ID to the actual node object. | ||
Redux stores nodes under the `nodes` namespace, whose state is a map of the node ID to the actual node object. |
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.
Redux stores nodes under the `nodes` namespace, whose state is a map of the node ID to the actual node object. | |
Redux stores nodes in the `nodes` namespace which is a map of ID to node Object. |
|
||
## Sourcing Nodes | ||
|
||
The creation of nodes occurs primarily in the [sourceNodes](/docs/node-apis/#sourceNodes) bootstrap phase. Nodes created during this phase are top level nodes. I.e, they have no parent. This is represented by source plugins setting the node's `parent` field to `null`. Nodes created via transform plugins (who implement [onCreateNode](/docs/node-apis/#onCreateNode)) will have source nodes as their parents, or other transformed nodes. For a rough overview of what happens when source nodes run, see the [traceID illustration](/docs/how-plugins-apis-are-run/#using-traceid-to-await-downstream-api-calls). | ||
The creation of nodes occurs primarily in the [sourceNodes](/docs/node-apis/#sourceNodes) bootstrap phase. Nodes created during this phase are top level nodes. I.e, they have no parent. source plugins setting the node's `parent` field to `null` represents this. Nodes created via transform plugins (who implement [onCreateNode](/docs/node-apis/#onCreateNode)) will have source nodes as their parents, or other transformed nodes. For a rough overview of what happens when source nodes run, see the [traceID illustration](/docs/how-plugins-apis-are-run/#using-traceid-to-await-downstream-api-calls). |
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.
The creation of nodes occurs primarily in the [sourceNodes](/docs/node-apis/#sourceNodes) bootstrap phase. Nodes created during this phase are top level nodes. I.e, they have no parent. source plugins setting the node's `parent` field to `null` represents this. Nodes created via transform plugins (who implement [onCreateNode](/docs/node-apis/#onCreateNode)) will have source nodes as their parents, or other transformed nodes. For a rough overview of what happens when source nodes run, see the [traceID illustration](/docs/how-plugins-apis-are-run/#using-traceid-to-await-downstream-api-calls). | |
The creation of nodes occurs primarily in the [sourceNodes](/docs/node-apis/#sourceNodes) bootstrap phase. Nodes created during this phase are top level nodes (i.e. they have no parent). Source plugins set the node's `parent` field to `null` to represent this. Nodes created via transformer plugins (which implement [onCreateNode](/docs/node-apis/#onCreateNode)) set source nodes as their parents, or other transformed nodes. For a rough overview of what happens when `sourceNodes` runs, see the [traceID illustration](/docs/how-plugins-apis-are-run/#using-traceid-to-await-downstream-api-calls). |
@@ -30,13 30,13 @@ An important note here is that we do not store a distinct collection of each typ | |||
|
|||
### Explicitly recording a parent/child relationship | |||
|
|||
This occurs when a transformer plugin implements [onCreateNode](/docs/node-apis/#onCreateNode) in order to create some child of the originally created node. In this case, the transformer plugin will call [createParentChildLink](/docs/actions/#createParentChildLink), with the original node, and the newly created node. All this does is push the child's node ID onto the parent's `children` collection and resave the parent to redux. | |||
This occurs when a transformer plugin implements [onCreateNode](/docs/node-apis/#onCreateNode) in order to create some child of the originally created node. In this case, the transformer plugin will call [createParentChildLink](/docs/actions/#createParentChildLink), with the original node, and the created node. All this does is push the child's node ID onto the parent's `children` collection and resave the parent to redux. |
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.
This occurs when a transformer plugin implements [onCreateNode](/docs/node-apis/#onCreateNode) in order to create some child of the originally created node. In this case, the transformer plugin will call [createParentChildLink](/docs/actions/#createParentChildLink), with the original node, and the created node. All this does is push the child's node ID onto the parent's `children` collection and resave the parent to redux. | |
This occurs when a transformer plugin implements [onCreateNode](/docs/node-apis/#onCreateNode) in order to create some child of the originally created node. In this case, the transformer plugin will call [createParentChildLink](/docs/actions/#createParentChildLink), with the original node, and the newly created node. All this does is push the child's node ID onto the parent's `children` collection and resave the parent to redux. |
Not sure if we need to remove this?
@@ -51,25 51,25 @@ Let's say you create the following node by passing it to `createNode` | |||
} | |||
``` | |||
|
|||
The value for `baz` is itself an object. That value's parent is the top level object. In this case, Gatsby simply saves the top level node as is to redux. It doesn't attempt to extract `baz` into its own node. It does however track the subobject's root NodeID using [Node Tracking](/docs/node-tracking/) | |||
The value for `baz` is itself an object. That value's parent is the top level object. In this case, Gatsby simply saves the top level node as is to redux. It doesn't attempt to extract `baz` into its node. But it tracks the subobject's root NodeID using [Node Tracking](/docs/node-tracking/) |
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 would revert this change? I don't think this is in the scope of the issue that we mean to address?
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.
You are right, reverting this.
@@ -35,27 37,27 @@ The digest should be unique to the content of this node since it's used for cach | |||
|
|||
### `mediaType` | |||
|
|||
Optional [media type](https://en.wikipedia.org/wiki/Media_type) to indicate to transformer plugins this node has data they can further process. | |||
Optional [media type](https://en.wikipedia.org/wiki/Media_type) to notify the transformer plugins this node has data they can further process. |
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.
Unsure if this is necessary
|
||
### `content` | ||
|
||
Optional field exposing the raw content for this node that transformer plugins can take and further process. | ||
|
||
## Source plugins | ||
|
||
New nodes are added to Gatsby by "source" plugins. A common one that many Gatsby | ||
`Source` plugins adds new nodes to Gatbsy. A common one that many Gatsby |
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.
`Source` plugins adds new nodes to Gatbsy. A common one that many Gatsby | |
Source plugins add new nodes to Gatsby. A common one that many Gatsby |
@@ -47,15 47,15 @@ Its sub objects are `foo` (value = `{ myfile: "blog/my-blog.md", b: 2}`), and th | |||
|
|||
## Find Root Nodes | |||
|
|||
To access this information, `node-tracking.js` provides the [findRootNodeAncestor()](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/schema/node-tracking.js#L52) function. It takes an object, and looks up its parent's nodeID in `rootNodeMap`. It then finds the actual node in redux. It then gets that node's `parent` ID, and gets the parent node from redux. And continues in this way until the root node is found. | |||
To access this information, `node-tracking.js` provides the [findRootNodeAncestor()](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/schema/node-tracking.js#L52) function. It takes an object, and looks up its parent's nodeID in `rootNodeMap`. It then finds the actual node in redux. It then gets that node's `parent` ID, and gets the parent node from redux. And continues in this way until it founds the root node. |
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.
To access this information, `node-tracking.js` provides the [findRootNodeAncestor()](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/schema/node-tracking.js#L52) function. It takes an object, and looks up its parent's nodeID in `rootNodeMap`. It then finds the actual node in redux. It then gets that node's `parent` ID, and gets the parent node from redux. And continues in this way until it founds the root node. | |
To access this information, `node-tracking.js` provides the [findRootNodeAncestor()](https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/src/schema/node-tracking.js#L52) function. It takes an object, and looks up its parent's nodeID in `rootNodeMap`. It then finds the actual node in redux. It then gets that node's `parent` ID, and gets the parent node from redux. And continues in this way until it finds the root node. |
|
||
Now, where do we use this information? In 2 places. | ||
Now, where do you use this information? In 2 places. |
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.
Now, where do you use this information? In 2 places. | |
Now, where does Gatsby use this information? In 2 places. |
|
||
1. In the `File` type resolver. It is used to lookup the node's root, which should be of type `File`. We can then use that root node's base directory attribute to create the full path of the resolved field's value, and therefore find the actual `File` node that the string value is describing. See [File GqlType inference](/docs/schema-gql-type/#file-types) for more info. | ||
1. In the `File` type resolver. It is used to lookup the node's root, which should be of type `File`. You can then use that root node's base directory attribute to create the full path of the resolved field's value, and therefore find the actual `File` node that the string value is describing. See [File GqlType inference](/docs/schema-gql-type/#file-types) for more info. |
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.
1. In the `File` type resolver. It is used to lookup the node's root, which should be of type `File`. You can then use that root node's base directory attribute to create the full path of the resolved field's value, and therefore find the actual `File` node that the string value is describing. See [File GqlType inference](/docs/schema-gql-type/#file-types) for more info. | |
1. In the `File` type resolver. It is used to lookup the node's root, which should be of type `File`. Gatsby can then use that root node's base directory attribute to create the full path of the resolved field's value, and therefore find the actual `File` node that the string value is describing. See [File GqlType inference](/docs/schema-gql-type/#file-types) for more info. |
Hey! Thanks so much for opening a pull request! We really appreciate you sending this over, but the changes you’ve proposed are not going to be accepted because they don't meaningfully improve docs. We would recommend opening a new PR with changes to the We absolutely want to have you as a contributor, so please take a look at [our open issues][open-issues] for ideas, and please reach out to us on Twitter at @gatsbyjs with questions. Thanks again, and we look forward to seeing more PRs from you in the future! 💪💜 |
Hi Marcy, Thanks for feedback, but can you elaborate a bit more about this,
Is this the correct link to Style Guide? I tried to implement these points from styleguide in this pr: Will open a new pr very soon, thanks again. |
Description
n
.we/our
wordings toyou/your
Related Issues
Related to #18284