From 071ac34c8dc0645e9e5f1de729c616ae7a96dddc Mon Sep 17 00:00:00 2001 From: Max Bolotin Date: Tue, 18 Apr 2023 15:06:39 +0200 Subject: [PATCH] always use entire field node as cache key --- packages/batch-delegate/src/getLoader.ts | 2 +- packages/batch-delegate/tests/basic.example.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/batch-delegate/src/getLoader.ts b/packages/batch-delegate/src/getLoader.ts index f9dcf915fa7..498eacc87f2 100644 --- a/packages/batch-delegate/src/getLoader.ts +++ b/packages/batch-delegate/src/getLoader.ts @@ -81,7 +81,7 @@ export function getLoader(options: BatchDelegateOptions let cacheKey = fieldName; - if (fieldNodes[0]?.selectionSet != null) { + if (fieldNodes[0]) { const fieldNode = { ...fieldNodes[0], alias: undefined, diff --git a/packages/batch-delegate/tests/basic.example.test.ts b/packages/batch-delegate/tests/basic.example.test.ts index 20a3efaf198..0d4790eb42e 100644 --- a/packages/batch-delegate/tests/basic.example.test.ts +++ b/packages/batch-delegate/tests/basic.example.test.ts @@ -97,7 +97,7 @@ describe('batch delegation within basic stitching example', () => { expect(chirps[0].chirpedAtUser.email).not.toBe(null); }); - test.only('uses a single call even when delegating the same field multiple times', async () => { + test('uses a single call even when delegating the same field multiple times', async () => { let numCalls = 0; const chirpSchema = makeExecutableSchema({