Skip to content

Commit

Permalink
docs: Document switching off type inference for SitePage.conte… (#16111)
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanprobst authored and sidharthachatterjee committed Jul 30, 2019
1 parent 2db54b3 commit ee703a6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/docs/scaling-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,18 @@ Loki allows us to opt-in to possibly more performant internal operations and it
}
}
```

### Switch off type inference for `SitePage.context`

When using the `createPages` API to pass large amounts of data to pages via `context` (which is generally not recommended), Gatsby's type inference can become slow. In most cases, it is not actually necessary to include the `SitePage.context` field in the GraphQL schema, so switching off type inference for the `SitePage` type should be safe:

```js
// gatsby-node.js
exports.createSchemaCustomization = ({ actions }) => {
actions.createTypes(`
type SitePage implements Node @dontInfer {
path: String!
}
`)
}
```

0 comments on commit ee703a6

Please sign in to comment.