From e9a490feca07a33209e888296247f5eb91f9edd7 Mon Sep 17 00:00:00 2001 From: Matt Dunn-Rankin Date: Tue, 19 May 2020 15:14:12 -0700 Subject: [PATCH] oops, we broke cacheRedirects, so item adds broke! --- src/app/apolloClient.js | 3 +-- src/app/useOutfitState.js | 8 +++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/app/apolloClient.js b/src/app/apolloClient.js index 37af783..0f4e7d0 100644 --- a/src/app/apolloClient.js +++ b/src/app/apolloClient.js @@ -35,7 +35,6 @@ const httpLink = createHttpLink({ uri: "/api/graphql" }); * queries. This is how we communicate with the server! */ export default new ApolloClient({ - cacheRedirects, link: persistedQueryLink.concat(httpLink), - cache: new InMemoryCache(), + cache: new InMemoryCache({ cacheRedirects }), }); diff --git a/src/app/useOutfitState.js b/src/app/useOutfitState.js index 25554b5..c71ebd6 100644 --- a/src/app/useOutfitState.js +++ b/src/app/useOutfitState.js @@ -124,7 +124,13 @@ const outfitStateReducer = (apolloClient) => (baseState, action) => { // doing a search and it loads before the worn item data does? Anyway, // Apollo will throw in that case, which should just essentially reject // the action.) - const conflictingIds = findItemConflicts(itemId, state, apolloClient); + let conflictingIds; + try { + conflictingIds = findItemConflicts(itemId, state, apolloClient); + } catch (e) { + console.error(e); + return; + } for (const conflictingId of conflictingIds) { wornItemIds.delete(conflictingId); closetedItemIds.add(conflictingId);