From 071bc77943046f13776fd3e049cba7a93e9fe29a Mon Sep 17 00:00:00 2001 From: Guo Liu Date: Mon, 29 Apr 2019 19:48:35 -0700 Subject: [PATCH] add deep copy to mergeConnections --- common/utils/connections.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/utils/connections.ts b/common/utils/connections.ts index 46aececcee..a770fe585c 100644 --- a/common/utils/connections.ts +++ b/common/utils/connections.ts @@ -17,8 +17,10 @@ export const mergeConnections = ({ const { edges: newEdges, pageInfo: newPageInfo } = _get(newData, path) const result = oldData + if (newPageInfo.endCursor !== oldPageInfo.endCursor) { - _set(result, path, { + const copy = JSON.parse(JSON.stringify(result)) + return _set(copy, path, { ...rest, pageInfo: newPageInfo, edges: [...oldEdges, ...newEdges]