You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Determines whether to cache the transformed GraphQL document. Caching can speed up repeated calls to the document transform for the same input document. Set to `false` to completely disable caching for the document transform. When disabled, this option takes precedence over the [`getCacheKey`](#getcachekey) option.
17
+
* Determines whether to cache the transformed GraphQL document. Caching can
18
+
* speed up repeated calls to the document transform for the same input
19
+
* document. Set to `false` to completely disable caching for the document
20
+
* transform. When disabled, this option takes precedence over the [`getCacheKey`](#getcachekey)
21
+
* option.
18
22
*
19
-
* The default value is `true`.
23
+
* @defaultValue`true`
20
24
*/
21
25
cache?: boolean;
22
26
/**
23
27
* Defines a custom cache key for a GraphQL document that will determine whether to re-run the document transform when given the same input GraphQL document. Returns an array that defines the cache key. Return `undefined` to disable caching for that GraphQL document.
24
28
*
25
-
* > **Note:** The items in the array may be any type, but also need to be referentially stable to guarantee a stable cache key.
29
+
* > [!NOTE]
30
+
* > The items in the array can be any type, but each item needs to be
31
+
* > referentially stable to guarantee a stable cache key.
26
32
*
27
-
* The default implementation of this function returns the `document` as the cache key.
33
+
* @defaultValue `(document) => [document]`
28
34
*/
29
35
getCacheKey?: (
30
36
document: DocumentNode
@@ -35,6 +41,25 @@ function identity(document: DocumentNode) {
35
41
returndocument;
36
42
}
37
43
44
+
/**
45
+
* A class for transforming GraphQL documents. See the [Document transforms
46
+
* documentation](https://www.apollographql.com/docs/react/data/document-transforms) for more details on using them.
47
+
*
48
+
* @example
49
+
*
50
+
* ```ts
51
+
* import { DocumentTransform } from "@apollo/client/utilities";
52
+
* import { visit } from "graphql";
53
+
*
54
+
* const documentTransform = new DocumentTransform((doc) => {
0 commit comments