From effa4a66162458a40192c495736a2f3a8864b237 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Thu, 9 Sep 2021 13:56:23 +0200 Subject: [PATCH] apollo cache merge function --- src/index.tsx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 3f84bcf..aede270 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -7,7 +7,24 @@ import "react-contexify/dist/ReactContexify.css" const client = new ApolloClient({ uri: "/api/graphql", - cache: new InMemoryCache() + cache: new InMemoryCache({ + typePolicies:{ + Query: { + fields: { + files: { + merge(existing, incoming){ + return incoming + } + }, + directorys:{ + merge(existing, incoming){ + return incoming + } + } + } + } + } + }) }) // Disable drag and drop behaviour on document