Unverified Commit 1c64c1e9 authored by Quinn Turner's avatar Quinn Turner Committed by GitHub

fix: Improve grammar of apollo.js comments (#10601)

parent 0acea5f4
...@@ -3,12 +3,12 @@ import App from 'next/app' ...@@ -3,12 +3,12 @@ import App from 'next/app'
import { ApolloProvider } from '@apollo/react-hooks' import { ApolloProvider } from '@apollo/react-hooks'
import createApolloClient from '../apolloClient' import createApolloClient from '../apolloClient'
// On the client we store the apollo client in the following variable // On the client, we store the Apollo Client in the following variable.
// this prevents the client from reinitializing between page transitions. // This prevents the client from reinitializing between page transitions.
let globalApolloClient = null let globalApolloClient = null
/** /**
* Installes the apollo client on NextPageContext * Installs the Apollo Client on NextPageContext
* or NextAppContext. Useful if you want to use apolloClient * or NextAppContext. Useful if you want to use apolloClient
* inside getStaticProps, getStaticPaths or getServerProps * inside getStaticProps, getStaticPaths or getServerProps
* @param {NextPageContext | NextAppContext} ctx * @param {NextPageContext | NextAppContext} ctx
...@@ -32,13 +32,13 @@ export const initOnContext = ctx => { ...@@ -32,13 +32,13 @@ export const initOnContext = ctx => {
ctx.apolloClient || ctx.apolloClient ||
initApolloClient(ctx.apolloState || {}, inAppContext ? ctx.ctx : ctx) initApolloClient(ctx.apolloState || {}, inAppContext ? ctx.ctx : ctx)
// To avoid calling initApollo() twice in the server we send the Apollo Client as a prop // We send the Apollo Client as a prop to the component to avoid calling initApollo() twice in the server.
// to the component, otherwise the component would have to call initApollo() again but this // Otherwise, the component would have to call initApollo() again but this
// time without the context, once that happens the following code will make sure we send // time without the context. Once that happens, the following code will make sure we send
// the prop as `null` to the browser // the prop as `null` to the browser.
apolloClient.toJSON = () => null apolloClient.toJSON = () => null
// Add apolloClient to NextPageContext & NextAppContext // Add apolloClient to NextPageContext & NextAppContext.
// This allows us to consume the apolloClient inside our // This allows us to consume the apolloClient inside our
// custom `getInitialProps({ apolloClient })`. // custom `getInitialProps({ apolloClient })`.
ctx.apolloClient = apolloClient ctx.apolloClient = apolloClient
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment