Skip to content

Commit 2d8b3eb

Browse files
Apply suggestions from code review
Co-authored-by: Jerel Miller <[email protected]>
1 parent 1615bd0 commit 2d8b3eb

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

src/cache/core/types/Cache.ts

Lines changed: 31 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,14 @@ export declare namespace Cache {
6767
result: Unmasked<TData>;
6868

6969
/**
70-
* Whether to notify query watchers (default: true).
70+
* Whether to notify query watchers.
71+
* @defaultValue true
7172
*/
7273
broadcast?: boolean;
7374
/**
7475
* When true, ignore existing field data rather than merging it with
75-
* incoming data (default: false).
76+
* incoming data.
77+
* @defaultValue false
7678
*/
7779
overwrite?: boolean;
7880
}
@@ -160,7 +162,7 @@ export declare namespace Cache {
160162
> {
161163
/**
162164
* The GraphQL query shape to be used constructed using the `gql` template
163-
* string tag from `graphql-tag`. The query will be used to determine the
165+
* string. The query will be used to determine the
164166
* shape of the data to be read.
165167
*/
166168
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
@@ -172,19 +174,20 @@ export declare namespace Cache {
172174

173175
/**
174176
* The root id to be used. Defaults to "ROOT_QUERY", which is the ID of the
175-
* root query object. This property makes writeQuery capable of writing data
176-
* to any object in the cache.
177+
* root query object. This property makes readQuery capable of reading data
178+
* from any object in the cache.
177179
*/
178180
id?: string;
179181
/**
180182
* Whether to return incomplete data rather than null.
181-
* Defaults to false.
183+
* @defaultValue false
182184
*/
183185
returnPartialData?: boolean;
184186
/**
185187
* Whether to read from optimistic or non-optimistic cache data. If
186188
* this named option is provided, the optimistic parameter of the
187-
* readQuery method can be omitted. Defaults to false.
189+
* readQuery method can be omitted.
190+
* @defaultValue false
188191
*/
189192
optimistic?: boolean;
190193
}
@@ -195,7 +198,7 @@ export declare namespace Cache {
195198
> {
196199
/**
197200
* The root id to be used. This id should take the same form as the
198-
* value returned by your `dataIdFromObject` function. If a value with your
201+
* value returned by the `cache.identify` function. If a value with your
199202
* id does not exist in the store, `null` will be returned.
200203
*/
201204
id?: string;
@@ -204,7 +207,8 @@ export declare namespace Cache {
204207
* A GraphQL document created using the `gql` template string tag from
205208
* `graphql-tag` with one or more fragments which will be used to determine
206209
* the shape of data to read. If you provide more than one fragment in this
207-
* document then you must also specify `fragmentName` to select a single.
210+
* document then you must also specify `fragmentName` to specify which
211+
* fragment is the root fragment.
208212
*/
209213
fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
210214

@@ -222,13 +226,14 @@ export declare namespace Cache {
222226

223227
/**
224228
* Whether to return incomplete data rather than null.
225-
* Defaults to false.
229+
* @defaultValue false
226230
*/
227231
returnPartialData?: boolean;
228232
/**
229233
* Whether to read from optimistic or non-optimistic cache data. If
230234
* this named option is provided, the optimistic parameter of the
231-
* readQuery method can be omitted. Defaults to false.
235+
* readFragment method can be omitted.
236+
* @defaultValue false
232237
*/
233238
optimistic?: boolean;
234239
}
@@ -257,16 +262,18 @@ export declare namespace Cache {
257262
id?: string;
258263

259264
/**
260-
* The data you will be writing to the store.
265+
* The data to write to the store.
261266
*/
262267
data: Unmasked<TData>;
263268
/**
264-
* Whether to notify query watchers (default: true).
269+
* Whether to notify query watchers.
270+
* @defaultValue true
265271
*/
266272
broadcast?: boolean;
267273
/**
268274
* When true, ignore existing field data rather than merging it with
269-
* incoming data (default: false).
275+
* incoming data.
276+
* @defaultValue false
270277
*/
271278
overwrite?: boolean;
272279
}
@@ -277,16 +284,17 @@ export declare namespace Cache {
277284
> {
278285
/**
279286
* The root id to be used. This id should take the same form as the
280-
* value returned by your `dataIdFromObject` function. If a value with your
287+
* value returned by the `cache.identify` function. If a value with your
281288
* id does not exist in the store, `null` will be returned.
282289
*/
283290
id?: string;
284291

285292
/**
286-
* A GraphQL document created using the `gql` template string tag from
287-
* `graphql-tag` with one or more fragments which will be used to determine
293+
* A GraphQL document created using the `gql` template string
294+
* with one or more fragments which will be used to determine
288295
* the shape of data to read. If you provide more than one fragment in this
289-
* document then you must also specify `fragmentName` to select a single.
296+
* document then you must also specify `fragmentName` to specify specify which
297+
* fragment is the root fragment.
290298
*/
291299
fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
292300

@@ -302,16 +310,18 @@ export declare namespace Cache {
302310
*/
303311
variables?: TVariables;
304312
/**
305-
* The data you will be writing to the store.
313+
* The data to write to the store.
306314
*/
307315
data: Unmasked<TData>;
308316
/**
309-
* Whether to notify query watchers (default: true).
317+
* Whether to notify query watchers.
318+
* @defaultValue true
310319
*/
311320
broadcast?: boolean;
312321
/**
313322
* When true, ignore existing field data rather than merging it with
314-
* incoming data (default: false).
323+
* incoming data.
324+
* @defaultValue false
315325
*/
316326
overwrite?: boolean;
317327
}

src/core/ApolloClient.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,8 @@ export class ApolloClient {
11421142
*
11431143
* @param optimistic - Set to `true` to allow `readFragment` to return
11441144
* optimistic results. Is `false` by default.
1145-
*/ public readFragment<
1145+
*/
1146+
public readFragment<
11461147
TData = unknown,
11471148
TVariables extends OperationVariables = OperationVariables,
11481149
>(

0 commit comments

Comments
 (0)