From b8226aaf947575c76ac1987fb17717e6d3cb9e64 Mon Sep 17 00:00:00 2001 From: MrDoomBringer Date: Wed, 19 Oct 2022 21:20:43 -0400 Subject: [PATCH 1/3] Support cloning Symbols in cloneDeep --- src/utilities/common/cloneDeep.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utilities/common/cloneDeep.ts b/src/utilities/common/cloneDeep.ts index c4714a3b7e0..ddeca7b8067 100644 --- a/src/utilities/common/cloneDeep.ts +++ b/src/utilities/common/cloneDeep.ts @@ -27,12 +27,12 @@ function cloneDeepHelper(val: T, seen?: Map): T { // possible in all JS environments, so we will assume they exist/work. const copy = Object.create(Object.getPrototypeOf(val)); seen.set(val, copy); - Object.keys(val).forEach(key => { + Object.keys(val).concat(Object.getOwnPropertySymbols(val) as any).forEach(key => { copy[key] = cloneDeepHelper((val as any)[key], seen); }); return copy; } - + default: return val; } From 4e0d977de00691a3ac856fc71da9fcc4f52e296b Mon Sep 17 00:00:00 2001 From: MrDoomBringer Date: Tue, 25 Oct 2022 11:16:43 -0400 Subject: [PATCH 2/3] Revert "Support cloning Symbols in cloneDeep" This reverts commit 2d5f4b185de1e46f0483e306eecb6f3443d26839. --- src/utilities/common/cloneDeep.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utilities/common/cloneDeep.ts b/src/utilities/common/cloneDeep.ts index ddeca7b8067..c4714a3b7e0 100644 --- a/src/utilities/common/cloneDeep.ts +++ b/src/utilities/common/cloneDeep.ts @@ -27,12 +27,12 @@ function cloneDeepHelper(val: T, seen?: Map): T { // possible in all JS environments, so we will assume they exist/work. const copy = Object.create(Object.getPrototypeOf(val)); seen.set(val, copy); - Object.keys(val).concat(Object.getOwnPropertySymbols(val) as any).forEach(key => { + Object.keys(val).forEach(key => { copy[key] = cloneDeepHelper((val as any)[key], seen); }); return copy; } - + default: return val; } From 7aab83f207cb6c87bf7f8cc15eca969c9fb9f697 Mon Sep 17 00:00:00 2001 From: MrDoomBringer Date: Tue, 25 Oct 2022 11:18:01 -0400 Subject: [PATCH 3/3] Revert "Ensure getResultsFromLink writes results using original options." This reverts commit b4ffcb60d7302d6297e084c0d99536c890475df1 --- src/core/QueryManager.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/core/QueryManager.ts b/src/core/QueryManager.ts index b3b511206a9..36fac27ef13 100644 --- a/src/core/QueryManager.ts +++ b/src/core/QueryManager.ts @@ -26,7 +26,6 @@ import { makeUniqueId, isDocumentNode, isNonNullObject, - cloneDeep, } from '../utilities'; import { ApolloError, isApolloError } from '../errors'; import { @@ -1038,10 +1037,6 @@ export class QueryManager { ): Observable> { const requestId = queryInfo.lastRequestId = this.generateRequestId(); - // Make sure we write the result below using the same options we were given, - // even though the input object may have been modified in the meantime. - options = cloneDeep(options); - // Performing transformForLink here gives this.cache a chance to fill in // missing fragment definitions (for example) before sending this document // through the link chain.