From 2eb8a7cd60c5d53eb73fb2979069d1530d4b6c4f Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 10 Aug 2023 18:59:47 -0700 Subject: [PATCH] Move Apollo error message stuff to apolloClient.js --- app/javascript/wardrobe-2020-page.js | 7 ------- app/javascript/wardrobe-2020/apolloClient.js | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/javascript/wardrobe-2020-page.js b/app/javascript/wardrobe-2020-page.js index 7f428d79..361175ea 100644 --- a/app/javascript/wardrobe-2020-page.js +++ b/app/javascript/wardrobe-2020-page.js @@ -1,15 +1,8 @@ import React from "react"; import ReactDOM from "react-dom"; -import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev"; 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"); ReactDOM.render( diff --git a/app/javascript/wardrobe-2020/apolloClient.js b/app/javascript/wardrobe-2020/apolloClient.js index ca3a2f0c..b318801a 100644 --- a/app/javascript/wardrobe-2020/apolloClient.js +++ b/app/javascript/wardrobe-2020/apolloClient.js @@ -1,9 +1,16 @@ import { ApolloClient, createHttpLink, InMemoryCache } from "@apollo/client"; +import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev"; import { setContext } from "@apollo/client/link/context"; import { createPersistedQueryLink } from "apollo-link-persisted-queries"; 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 // requests. This happens a lot - e.g. reusing data from item search on the // outfit immediately!