Skip to content

Commit 172c853

Browse files
committed
Add defer/stream tutorial
1 parent 060db4a commit 172c853

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: Enabling Defer & Stream
3+
sidebar_label: Enabling Defer & Stream
4+
---
5+
6+
The `@defer` and `@stream` directives are not enabled by default. In order to use these directives, you must add them to your GraphQL Schema.
7+
8+
```js
9+
import {
10+
GraphQLSchema,
11+
GraphQLDeferDirective,
12+
GraphQLStreamDirective,
13+
specifiedDirectives,
14+
} from 'graphql';
15+
16+
const schema = new GraphQLSchema({
17+
query,
18+
directives: [
19+
...specifiedDirectives,
20+
GraphQLDeferDirective,
21+
GraphQLStreamDirective,
22+
],
23+
});
24+
```
25+
26+
If the `directives` option is passed to `GraphQLSchema`, the default directives will not be included. `specifiedDirectives` must be passed to ensure all standard directives are added in addition to `defer` & `stream`.

website/sidebars.js

+1
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ module.exports = {
1616
items: ['tutorials/constructing-types'],
1717
},
1818
'tutorials/express-graphql',
19+
'tutorials/defer-stream',
1920
],
2021
};

0 commit comments

Comments
 (0)