Move Apollo error message stuff to apolloClient.js

This commit is contained in:
Emi Matchu 2023-08-10 18:59:47 -07:00
parent eef8f1349d
commit 2eb8a7cd60
2 changed files with 7 additions and 7 deletions

View file

@ -1,15 +1,8 @@
import React from "react"; import React from "react";
import ReactDOM from "react-dom"; import ReactDOM from "react-dom";
import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev";
import { AppProvider, WardrobePage } from "./wardrobe-2020"; import { AppProvider, WardrobePage } from "./wardrobe-2020";
// Use Apollo's error messages in development.
if (process.env["NODE_ENV"] === "development") {
loadErrorMessages();
loadDevMessages();
}
const rootNode = document.querySelector("#wardrobe-2020-root"); const rootNode = document.querySelector("#wardrobe-2020-root");
ReactDOM.render( ReactDOM.render(
<AppProvider> <AppProvider>

View file

@ -1,9 +1,16 @@
import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client"; import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client";
import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev";
import { setContext } from "@apollo/client/link/context"; import { setContext } from "@apollo/client/link/context";
import { createPersistedQueryLink } from "apollo-link-persisted-queries"; import { createPersistedQueryLink } from "apollo-link-persisted-queries";
import { getAuthModeFeatureFlag } from "./components/useCurrentUser"; import { getAuthModeFeatureFlag } from "./components/useCurrentUser";
// Use Apollo's error messages in development.
if (process.env["NODE_ENV"] === "development") {
loadErrorMessages();
loadDevMessages();
}
// Teach Apollo to load certain fields from the cache, to avoid extra network // Teach Apollo to load certain fields from the cache, to avoid extra network
// requests. This happens a lot - e.g. reusing data from item search on the // requests. This happens a lot - e.g. reusing data from item search on the
// outfit immediately! // outfit immediately!