From 8e8eea2b3989b41de0c0d02309979cd6e3aa96b6 Mon Sep 17 00:00:00 2001 From: Matt Dunn-Rankin Date: Wed, 22 Apr 2020 16:18:29 -0700 Subject: [PATCH] add cache redirects for the items query --- src/App.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/App.js b/src/App.js index aa4e4ca..dd6692b 100644 --- a/src/App.js +++ b/src/App.js @@ -7,6 +7,12 @@ import ApolloClient from "apollo-boost"; const client = new ApolloClient({ uri: "/api/graphql", + cacheRedirects: { + Query: { + items: (_, args, { getCacheKey }) => + args.ids.map((id) => getCacheKey({ __typename: "Item", id })), + }, + }, }); function App() {