-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/contentful-improve-network-error-handling
- Loading branch information
Showing
309 changed files
with
2,496 additions
and
557 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -435,13 +435,42 @@ type AuthorJson implements Node { | |
} | ||
``` | ||
|
||
This example assumes that your markdown frontmatter is in the shape of: | ||
|
||
```markdown | ||
--- | ||
reviewers: | ||
- jane@example.com | ||
- doe@example.com | ||
--- | ||
``` | ||
|
||
And your author JSON looks like this: | ||
|
||
```json | ||
[ | ||
{ | ||
"name": "Doe", | ||
"firstName": "Jane", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Doe", | ||
"firstName": "Zoe", | ||
"email": "[email protected]" | ||
} | ||
] | ||
``` | ||
|
||
You provide a `@link` directive on a field and Gatsby will internally | ||
add a resolver that is quite similar to the one written manually above. If no | ||
argument is provided, Gatsby will use the `id` field as the foreign-key, | ||
otherwise the foreign-key has to be provided with the `by` argument. The | ||
optional `from` argument allows getting the field on the current type which acts as the foreign-key to the field specified in `by`. | ||
In other words, you `link` **on** `from` **to** `by`. This makes `from` especially helpful when adding a field for back-linking. | ||
|
||
For the above example you can read `@link` this way: Use the value from the field `Frontmatter.reviewers` and match it by the field `AuthorJson.email`. | ||
|
||
Keep in mind that in the example above, the link of `posts` in `AuthorJson` works because `frontmatter` and `author` are both objects. If, for example, the `Frontmatter` type had a list of `authors` instead (`frontmatter.authors.email`), it wouldn't work since the `by` argument doesn't support arrays. In that case, you'd have to provide a custom resolver with [Gatsby Type Builders](/docs/reference/graphql-data-layer/schema-customization/#gatsby-type-builders) or [createResolvers API](/docs/reference/graphql-data-layer/schema-customization/#createresolvers-api). | ||
|
||
> Note that when using `createTypes` to fix type inference for a foreign-key field | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"parserOptions": { | ||
"babelOptions": { | ||
"configFile": "../../.babelrc.js" | ||
} | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
e2e-tests/development-runtime/content/error-recovery/page-query.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"selector": "page-query", | ||
"hasError": false | ||
} |
4 changes: 4 additions & 0 deletions
4
e2e-tests/development-runtime/content/error-recovery/static-query.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"selector": "static-query", | ||
"hasError": false | ||
} |
Oops, something went wrong.