Skip to content

Commit 71e55ae

Browse files
committed
Tidy and add a changelog entry.
1 parent 9372225 commit 71e55ae

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
- Use the TypeScript v5.5+ JSDoc tag `@import` to import types in modules.
99
- Updated dev dependencies, some of which require newer Node.js versions than previously supported.
1010

11+
### Minor
12+
13+
- Added a new function `createUploadLink` option `includeUnusedVariables` defaulting to `false` to toggle including unused GraphQL variables in the request (similar to the Apollo `BaseHttpLink` option [`includeUnusedVariables`](https://www.apollographql.com/docs/react/api/link/apollo-link-base-http#options-includeunusedvariables)), via [#348](https://github.com/jaydenseric/apollo-upload-client/pull/348).
14+
1115
### Patch
1216

1317
- Updated the package scripts:

createUploadLink.mjs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ import isExtractableFile from "./isExtractableFile.mjs";
7070
* {@linkcode fetchOptions}.
7171
* @param {boolean} [options.includeExtensions] Toggles sending `extensions`
7272
* fields to the GraphQL server. Defaults to `false`.
73-
* @param {boolean} [options.includeUnusedVariables] * If set to true, the default behavior of stripping unused variables
74-
* from the request will be disabled. Defaults to `false`.
73+
* @param {boolean} [options.includeUnusedVariables] Toggles including unused
74+
* GraphQL variables in the request. Defaults to `false`.
7575
* @returns A [terminating Apollo Link](https://www.apollographql.com/docs/react/api/link/introduction/#the-terminating-link).
7676
* @example
7777
* A basic Apollo Client setup:
@@ -146,12 +146,11 @@ export default function createUploadLink({
146146
contextConfig,
147147
);
148148

149-
if (body.variables && !includeUnusedVariables) {
149+
if (body.variables && !includeUnusedVariables)
150150
body.variables = filterOperationVariables(
151151
body.variables,
152152
operation.query,
153153
);
154-
}
155154

156155
const { clone, files } = extractFiles(body, customIsExtractableFile, "");
157156

createUploadLink.test.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ describe("Function `createUploadLink`.", { concurrency: true }, () => {
314314
deepStrictEqual(nextData, payload);
315315
});
316316

317-
it("Option `includeUnusedVariables`, set to false", async () => {
317+
it("Option `includeUnusedVariables`, set to false.", async () => {
318318
/** @type {unknown} */
319319
let fetchInput;
320320

@@ -325,7 +325,7 @@ describe("Function `createUploadLink`.", { concurrency: true }, () => {
325325
let nextData;
326326

327327
const query = "query ($a: Boolean) {\n a(a: $a)\n}";
328-
const payload = { data: { a: true, b: true } };
328+
const payload = { data: { a: true } };
329329

330330
await timeLimitPromise(
331331
/** @type {Promise<void>} */ (
@@ -384,7 +384,7 @@ describe("Function `createUploadLink`.", { concurrency: true }, () => {
384384
deepStrictEqual(nextData, payload);
385385
});
386386

387-
it("Option `includeUnusedVariables`, set to true", async () => {
387+
it("Option `includeUnusedVariables`, set to true.", async () => {
388388
/** @type {unknown} */
389389
let fetchInput;
390390

@@ -395,7 +395,7 @@ describe("Function `createUploadLink`.", { concurrency: true }, () => {
395395
let nextData;
396396

397397
const query = "query ($a: Boolean) {\n a(a: $a)\n}";
398-
const payload = { data: { a: true, b: true } };
398+
const payload = { data: { a: true } };
399399

400400
await timeLimitPromise(
401401
/** @type {Promise<void>} */ (

0 commit comments

Comments
 (0)