Skip to content

Commit b27a724

Browse files
committed
apply review feedback to ApolloClient options, too
1 parent 2d8b3eb commit b27a724

File tree

2 files changed

+41
-33
lines changed

2 files changed

+41
-33
lines changed

src/cache/core/types/Cache.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export declare namespace Cache {
162162
> {
163163
/**
164164
* The GraphQL query shape to be used constructed using the `gql` template
165-
* string. The query will be used to determine the
165+
* string tag. The query will be used to determine the
166166
* shape of the data to be read.
167167
*/
168168
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
@@ -186,7 +186,7 @@ export declare namespace Cache {
186186
/**
187187
* Whether to read from optimistic or non-optimistic cache data. If
188188
* this named option is provided, the optimistic parameter of the
189-
* readQuery method can be omitted.
189+
* readQuery method can be omitted.
190190
* @defaultValue false
191191
*/
192192
optimistic?: boolean;
@@ -207,7 +207,7 @@ export declare namespace Cache {
207207
* A GraphQL document created using the `gql` template string tag from
208208
* `graphql-tag` with one or more fragments which will be used to determine
209209
* the shape of data to read. If you provide more than one fragment in this
210-
* document then you must also specify `fragmentName` to specify which
210+
* document then you must also specify `fragmentName` to specify which
211211
* fragment is the root fragment.
212212
*/
213213
fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
@@ -232,7 +232,7 @@ export declare namespace Cache {
232232
/**
233233
* Whether to read from optimistic or non-optimistic cache data. If
234234
* this named option is provided, the optimistic parameter of the
235-
* readFragment method can be omitted.
235+
* readFragment method can be omitted.
236236
* @defaultValue false
237237
*/
238238
optimistic?: boolean;
@@ -293,7 +293,7 @@ export declare namespace Cache {
293293
* A GraphQL document created using the `gql` template string
294294
* with one or more fragments which will be used to determine
295295
* the shape of data to read. If you provide more than one fragment in this
296-
* document then you must also specify `fragmentName` to specify specify which
296+
* document then you must also specify `fragmentName` to specify specify which
297297
* fragment is the root fragment.
298298
*/
299299
fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;

src/core/ApolloClient.ts

Lines changed: 36 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -397,28 +397,29 @@ export declare namespace ApolloClient {
397397
> {
398398
/**
399399
* The GraphQL query shape to be used constructed using the `gql` template
400-
* string tag from `graphql-tag`. The query will be used to determine the
400+
* string tag. The query will be used to determine the
401401
* shape of the data to be read.
402402
*/
403403
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
404404

405405
/**
406406
* The root id to be used. Defaults to "ROOT_QUERY", which is the ID of the
407-
* root query object. This property makes writeQuery capable of writing data
408-
* to any object in the cache.
407+
* root query object. This property makes `readQuery` capable of reading data
408+
* from any object in the cache.
409409
*/
410410
id?: string;
411411

412412
/**
413413
* Whether to return incomplete data rather than null.
414-
* Defaults to false.
414+
* @defaultValue false
415415
*/
416416
returnPartialData?: boolean;
417417

418418
/**
419-
* Whether to read from optimistic or non-optimistic cache data. If
420-
* this named option is provided, the optimistic parameter of the
421-
* readQuery method can be omitted. Defaults to false.
419+
* Whether to read from optimistic or non-optimistic cache data.
420+
* This option should be preferred over the `optimistic` parameter of the
421+
* `readQuery` method.
422+
* @defaultValue false
422423
*/
423424
optimistic?: boolean;
424425
}
@@ -447,16 +448,17 @@ export declare namespace ApolloClient {
447448
> {
448449
/**
449450
* The root id to be used. This id should take the same form as the
450-
* value returned by your `dataIdFromObject` function. If a value with your
451+
* value returned by the `cache.identify` function. If a value with your
451452
* id does not exist in the store, `null` will be returned.
452453
*/
453454
id?: string;
454455

455456
/**
456-
* A GraphQL document created using the `gql` template string tag from
457-
* `graphql-tag` with one or more fragments which will be used to determine
457+
* A GraphQL document created using the `gql` template string tag
458+
* with one or more fragments which will be used to determine
458459
* the shape of data to read. If you provide more than one fragment in this
459-
* document then you must also specify `fragmentName` to select a single.
460+
* document then you must also specify `fragmentName` to specify which
461+
* fragment is the root fragment.
460462
*/
461463
fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
462464

@@ -469,13 +471,14 @@ export declare namespace ApolloClient {
469471

470472
/**
471473
* Whether to return incomplete data rather than null.
472-
* Defaults to false.
474+
* @defaultValue false
473475
*/
474476
returnPartialData?: boolean;
475477
/**
476-
* Whether to read from optimistic or non-optimistic cache data. If
477-
* this named option is provided, the optimistic parameter of the
478-
* readQuery method can be omitted. Defaults to false.
478+
* Whether to read from optimistic or non-optimistic cache data.
479+
* This option should be preferred over the `optimistic` parameter of the
480+
* `readFragment` method.
481+
* @defaultValue false
479482
*/
480483
optimistic?: boolean;
481484
}
@@ -504,7 +507,7 @@ export declare namespace ApolloClient {
504507
> {
505508
/**
506509
* The GraphQL query shape to be used constructed using the `gql` template
507-
* string tag from `graphql-tag`. The query will be used to determine the
510+
* string tag. The query will be used to determine the
508511
* shape of the data to be read.
509512
*/
510513
query: DocumentNode | TypedDocumentNode<TData, TVariables>;
@@ -516,16 +519,18 @@ export declare namespace ApolloClient {
516519
*/
517520
id?: string;
518521
/**
519-
* The data you will be writing to the store.
522+
* The data to write to the store.
520523
*/
521524
data: Unmasked<TData>;
522525
/**
523-
* Whether to notify query watchers (default: true).
526+
* Whether to notify query watchers.
527+
* @defaultValue true
524528
*/
525529
broadcast?: boolean;
526530
/**
527531
* When true, ignore existing field data rather than merging it with
528-
* incoming data (default: false).
532+
* incoming data.
533+
* @defaultValue false
529534
*/
530535
overwrite?: boolean;
531536
}
@@ -554,7 +559,7 @@ export declare namespace ApolloClient {
554559
> {
555560
/**
556561
* The root id to be used. This id should take the same form as the
557-
* value returned by your `dataIdFromObject` function. If a value with your
562+
* value returned by the `cache.identify` function. If a value with your
558563
* id does not exist in the store, `null` will be returned.
559564
*/
560565
id?: string;
@@ -563,7 +568,8 @@ export declare namespace ApolloClient {
563568
* A GraphQL document created using the `gql` template string tag from
564569
* `graphql-tag` with one or more fragments which will be used to determine
565570
* the shape of data to read. If you provide more than one fragment in this
566-
* document then you must also specify `fragmentName` to select a single.
571+
* document then you must also specify `fragmentName` to specify which
572+
* fragment is the root fragment.
567573
*/
568574
fragment: DocumentNode | TypedDocumentNode<TData, TVariables>;
569575

@@ -575,16 +581,18 @@ export declare namespace ApolloClient {
575581
fragmentName?: string;
576582

577583
/**
578-
* The data you will be writing to the store.
584+
* The data to write to the store.
579585
*/
580586
data: Unmasked<TData>;
581587
/**
582-
* Whether to notify query watchers (default: true).
588+
* Whether to notify query watchers.
589+
* @defaultValue true
583590
*/
584591
broadcast?: boolean;
585592
/**
586593
* When true, ignore existing field data rather than merging it with
587-
* incoming data (default: false).
594+
* incoming data.
595+
* @defaultValue false
588596
*/
589597
overwrite?: boolean;
590598
}
@@ -857,7 +865,7 @@ export class ApolloClient {
857865
*
858866
* For example, suppose you call watchQuery on a GraphQL query that fetches a person's
859867
* first and last name and this person has a particular object identifier, provided by
860-
* dataIdFromObject. Later, a different query fetches that same person's
868+
* `cache.identify`. Later, a different query fetches that same person's
861869
* first and last name and the first name has now changed. Then, any observers associated
862870
* with the results of the first query will be updated with a new result object.
863871
*
@@ -1031,7 +1039,7 @@ export class ApolloClient {
10311039
/**
10321040
* Tries to read some data from the store in the shape of the provided
10331041
* GraphQL query without making a network request. This method will start at
1034-
* the root query. To start at a specific id returned by `dataIdFromObject`
1042+
* the root query. To start at a specific id returned by `cache.identify`
10351043
* use `readFragment`.
10361044
*
10371045
* @param optimistic - Set to `true` to allow `readQuery` to return
@@ -1142,7 +1150,7 @@ export class ApolloClient {
11421150
*
11431151
* @param optimistic - Set to `true` to allow `readFragment` to return
11441152
* optimistic results. Is `false` by default.
1145-
*/
1153+
*/
11461154
public readFragment<
11471155
TData = unknown,
11481156
TVariables extends OperationVariables = OperationVariables,
@@ -1179,7 +1187,7 @@ export class ApolloClient {
11791187
/**
11801188
* Writes some data in the shape of the provided GraphQL query directly to
11811189
* the store. This method will start at the root query. To start at a
1182-
* specific id returned by `dataIdFromObject` then use `writeFragment`.
1190+
* specific id returned by `cache.identify` then use `writeFragment`.
11831191
*/
11841192
public writeQuery<
11851193
TData = unknown,

0 commit comments

Comments
 (0)