Skip to content
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

Closed
wants to merge 6 commits into from
Closed

chore(docs): Fix docs starting with n #19065

wants to merge 6 commits into from

Conversation

brkn
Copy link
Contributor

@brkn brkn commented Oct 27, 2019

Description

  • Checked all docs starting with n.
  • Fixed heading levels
  • Changed we/our wordings to you/your
  • Cleaned some passive voice uses

Related Issues

Related to #18284

@brkn brkn requested a review from a team as a code owner October 27, 2019 19:26
@brkn brkn self-assigned this Oct 27, 2019
@brkn brkn changed the title chore(docs): Fix heading levels and we/our usages at docs starting with n chore(docs): Fix docs starting with n Oct 28, 2019
@LekoArts LekoArts added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Oct 28, 2019
Copy link
Contributor

@sidharthachatterjee sidharthachatterjee left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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/)
Copy link
Contributor

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?

Copy link
Contributor Author

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.
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

@brkn brkn added the status: awaiting reviewer response A pull request that is currently awaiting a reviewer's response label Oct 29, 2019
@marcysutton
Copy link
Contributor

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 node-tracking.md doc to change the word "we" into "Gatsby", and omit the other changes as they don't follow the Style Guide.

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! 💪💜
[open-issues]: https://github.com/gatsbyjs/gatsby/issues?q=is:issue is:open sort:updated-desc

@brkn
Copy link
Contributor Author

brkn commented Oct 29, 2019

Hi Marcy,

Thanks for feedback, but can you elaborate a bit more about this,

omit the other changes as they don't follow the Style Guide.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: awaiting reviewer response A pull request that is currently awaiting a reviewer's response type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants