Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 4ffd51f

Browse files
committed
docs(graphql-cookbook): Fix @kapunahelewong review
1 parent e9ac26b commit 4ffd51f

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

public/docs/ts/latest/cookbook/graphql.jade

+18-16
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ include ../_util-fns
66

77
.l-sub-section
88
:marked
9-
GraphQL is a replacement or enhancement for REST and can be used in conjunction with it.
9+
The GraphQL interface is a replacement or enhancement for REST and can be used in conjunction with it.
1010

1111
:marked
12-
GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
12+
It provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
1313

1414

1515
<a id="toc"></a>
@@ -43,18 +43,18 @@ include ../_util-fns
4343
:marked
4444
## What is GraphQL?
4545

46-
GraphQL is an API query language, helping your Angular app:
46+
GraphQL is an API query language, that helps your Angular app do the following:
4747

4848
- Fetch exactly the information it needs from the server.
4949
- Add type safety to your API.
5050
- Merge multiple dependencies into one single response from the server.
5151
- Handle server data dependency in a component structure.
5252

53-
It’s also important to understand that:
53+
It’s also important to understand these key points:
5454

5555
- **GraphQL is not a data source**. The GraphQL runtime works on top of any data source&mdash;SQL,
56-
NoSql, REST, Queues, .NET servers, Java servers or any other technology or data source.
57-
- GraphQL solves the need of sending multiple requests for multiple resources to the server and
56+
NoSql, REST, Queues, .NET servers, Java servers, or any other technology or data source.
57+
- GraphQL solves the need of sending multiple requests to the server for different resources and
5858
then running complex joins on the client&mdash;without the need to create a custom endpoint like REST does.
5959
- The GraphQL specification also includes protocols for real-time push updates from the server to the client.
6060

@@ -67,8 +67,8 @@ include ../_util-fns
6767

6868
.l-sub-section
6969
:marked
70-
For a summary of this section, see [Faster modern apps with Angular and GraphQL](https://www.youtube.com/watch?v=Xx39bv-5ojA&t=1s)
71-
presented by [Jeff Cross](https://twitter.com/jeffbcross) and [Uri Goldshtein](https://twitter.com/UriGoldshtein).
70+
For a summary of this section, see the following [video](https://www.youtube.com/watch?v=Xx39bv-5ojA&t=1s)
71+
by [Jeff Cross](https://twitter.com/jeffbcross) and [Uri Goldshtein](https://twitter.com/UriGoldshtein).
7272

7373
iframe(type='text/html' width='560' height='315'
7474
src='https://www.youtube.com/embed/Xx39bv-5ojA'
@@ -86,13 +86,15 @@ iframe(type='text/html' width='560' height='315'
8686
3. Fetching data at the parent component and passing it down the component tree.
8787

8888
While these solutions are valid, they have their limitations.
89+
90+
The following three sections cover each of these in turn.
8991

9092
#### Using the HTTP service in the Component
9193

9294
There are two potential issues with this approach:
9395

9496
1. Multiple redundant requests; when you render multiple components,
95-
for example, through `ngFor` with many components, each sends its own
97+
such as an `ngFor` with many components, each sends its own
9698
HTTP call.
9799
2. Inconsistent data; if two components fetch the same data but in different requests,
98100
the data might change and not be consistent across the app.
@@ -118,7 +120,7 @@ a#http-heroes
118120
:marked
119121
#### Fetching data at the parent component and passing it down the component tree
120122

121-
Consider an example of the second possibility:
123+
Consider an example of the third possibility:
122124

123125
+makeExample('toh-4/ts/src/app/hero.ts','','Declare the API type')
124126
+makeExample('toh-4/ts/src/app/hero-detail.component.ts','declaring-conponent-input','Declare the input')
@@ -127,7 +129,7 @@ a#http-heroes
127129
:marked
128130
This works until you change the API of the component, which means you need to change
129131
its parent components _all the way to the top_.
130-
Again, this creates a dependency. This time it is with the child component
132+
Again, this creates a dependency. This time the dependency is with the child component
131133
all the way up to the fetching component
132134
and _all the components in between_.
133135

@@ -145,12 +147,12 @@ a#http-heroes
145147
Now, a single component contains all of its own data dependency changes.
146148

147149
:marked
148-
The `watchQuery` function tells the Apollo Client what data
149-
this component needs. The Apollo Client then returns the
150+
The `watchQuery` function tells the Apollo Client, the GraphQL client that lets you use GraphQL in your Angular app,
151+
what data this component needs. The Apollo Client then returns the
150152
necessary data to the component as an Observable.
151153
For example, adding an `age` field to the app is
152154
simple because you only change the component (you cover
153-
this syntax [later](#querying) in the cookbook) And then modify the template accordingly:
155+
this syntax [later](#querying) in the cookbook) and then modify the template accordingly:
154156

155157
+makeExample('heroes-graphql/ts/src/app/hero-detail.component.1.ts','graphql-query-new-field','Adding an `age` field to the component')
156158
+makeExample('heroes-graphql/ts/src/app/hero-detail.component.1.html','template-new-field','Adding an `age` field to the template')
@@ -169,7 +171,7 @@ a#http-heroes
169171
calls `getHeroes` to fetch all heroes and their information.
170172

171173
:marked
172-
That might work for simple cases but the problem here is that `getHeroes` might fetch
174+
That might work for simple cases but but as your app grows `getHeroes` might fetch
173175
more information than the app really needs for each hero.
174176
This approach also creates a dependency between the server endpoint and the UI
175177
component&mdash;if you change or limit the amount of information you send on the
@@ -196,7 +198,7 @@ a#http-heroes
196198
and migrate gradually from them.
197199

198200
:marked
199-
### Typed API, tooling and auto documentation
201+
### Typed API, tooling and, auto documentation
200202

201203
Just as TypeScript provides tooling to increase productivity and best practices,
202204
GraphQL provides a similar solution for working with APIs.

0 commit comments

Comments
 (0)