From b4ffcb60d7302d6297e084c0d99536c890475df1 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Fri, 13 May 2022 14:29:09 -0400 Subject: [PATCH] Ensure getResultsFromLink writes results using original options. --- src/core/QueryManager.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/QueryManager.ts b/src/core/QueryManager.ts index bf9c6613d4d..12db6daa4df 100644 --- a/src/core/QueryManager.ts +++ b/src/core/QueryManager.ts @@ -25,6 +25,7 @@ import { makeUniqueId, isDocumentNode, isNonNullObject, + cloneDeep, } from '../utilities'; import { ApolloError, isApolloError } from '../errors'; import { @@ -1034,6 +1035,10 @@ 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); + return asyncMap( this.getObservableFromLink( queryInfo.document!,