oops, we broke cacheRedirects, so item adds broke!

This commit is contained in:
Matt Dunn-Rankin 2020-05-19 15:14:12 -07:00
parent 94b05ad95b
commit e9a490feca
2 changed files with 8 additions and 3 deletions

View file

@ -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 }),
});

View file

@ -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);