Skip to content

Commit

Permalink
feat(docs): Better docs for big chunk of schema stuff (#25503)
Browse files Browse the repository at this point in the history
* feat(docs): Better docs for big chunk of schema stuff

Remove stale links

Apply suggestions from code review

Co-authored-by: Yogi <me@yogi.codes>

Apply suggestions from code review

Co-authored-by: Aisha Blake <aisha@gatsbyjs.com>

Rephrased mapping and added redirects

* Fix linter

Co-authored-by: Aisha Blake <aisha@gatsbyjs.com>
  • Loading branch information
freiksenet and Aisha Blake authored Aug 13, 2020
1 parent 3d1cc4b commit aa26bc2
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 304 deletions.
6 changes: 3 additions & 3 deletions docs/docs/node-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ All nodes in Gatsby are stored in a flat structure in the redux `nodes` namespac
}
```

An important note here is that we do not store a distinct collection of each type of child. Rather we store a single collection that they're all packed into. This has some implications on [child field inference](/docs/schema-gql-type/#child-fields-creation) in the Schema Generation phase.
An important note here is that we do not store a distinct collection of each type of child. Rather we store a single collection that they're all packed into. This has some implications on [child field inference](/docs/schema-generation/#parent-children-relationships) in the Schema Generation phase.

### Explicitly recording a parent/child relationship

Expand All @@ -36,7 +36,7 @@ This does **not** automatically create a `parent` field on the child node. If a

### Foreign Key reference (`___NODE`)

We've established that child nodes are stored at the top level in redux, and are referenced via ids in their parent's `children` collection. The same mechanism drives foreign key relationships. Foreign key fields have a `___NODE` suffix on the field name. At query time, Gatsby will take the field's value as an ID, and search redux for a matching node. This is explained in more detail in [schema gqlTypes](/docs/schema-gql-type#foreign-key-reference-___node).
We've established that child nodes are stored at the top level in redux, and are referenced via ids in their parent's `children` collection. The same mechanism drives foreign key relationships. Foreign key fields have a `___NODE` suffix on the field name. At query time, Gatsby will take the field's value as an ID, and search redux for a matching node. This is explained in more detail in [schema gqlTypes](/docs/schema-inference#foreign-key-reference-___node).

### Plain objects at creation time

Expand All @@ -53,7 +53,7 @@ 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/)

During schema compilation, Gatsby will infer the sub object's type while [creating the gqlType](/docs/schema-gql-type#plain-object-or-value-field).
During schema compilation, Gatsby will infer the sub object's type while [creating the gqlType](/docs/schema-inference#plain-object-or-value-field).

## Fresh/stale nodes

Expand Down
106 changes: 0 additions & 106 deletions docs/docs/schema-connections.md

This file was deleted.

Loading

0 comments on commit aa26bc2

Please sign in to comment.