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
Copy file name to clipboardExpand all lines: README.md
+21
Original file line number
Diff line number
Diff line change
@@ -18,6 +18,7 @@ Minimal GraphQL client supporting Node and browsers for scripts or simple apps
18
18
-[None (default)](#none-default)
19
19
-[Ignore](#ignore)
20
20
-[All](#all)
21
+
-[IgnoreOperationName](#ignoreoperationname)
21
22
-[Knowledge Base](#knowledge-base)
22
23
-[Why was the file upload feature taken away? Will it return?](#why-was-the-file-upload-feature-taken-away-will-it-return)
23
24
-[Why do I have to install `graphql`?](#why-do-i-have-to-install-graphql)
@@ -152,6 +153,26 @@ Ignore incoming errors and resolve like no errors occurred
152
153
153
154
Return both the errors and data, only works with `rawRequest`.
154
155
156
+
### IgnoreOperationName
157
+
158
+
OperationName has been introduced to address issues reported here [Support operation name](https://github.com/jasonkuhrt/graphql-request/issues/64),
159
+
However, on certain occasions this information may not be needed in requests. In such cases, you might consider ignoring operationName to avoid the extraction steps currently performed by a parsing operation when the document is provided in string format.
160
+
161
+
By default the GraphQLClient tries to extract the operationName from the document.
162
+
You can define `excludeOperationName` in the constructor of GraphQLClient to avoid the extraction process if it is not needed. This can be useful if you don't use operationName and want to optimise queries by reducing the amount of computation as much as possible, especially if we are in a context where we are using documents in string format to reduce bundle size.
163
+
164
+
```ts
165
+
// example where the operation name is not ignored
166
+
const client =newGraphQLClient(endpoint, {
167
+
method: 'POST',
168
+
})
169
+
// example in which the operation name is ignored
170
+
const client =newGraphQLClient(endpoint, {
171
+
method: 'POST',
172
+
excludeOperationName: true,
173
+
})
174
+
```
175
+
155
176
## Knowledge Base
156
177
157
178
#### Why was the file upload feature taken away? Will it return?
0 commit comments