Skip to content

Commit

Permalink
fix: Improve grammar of apollo.js comments (#10601)
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnturner committed Feb 19, 2020
1 parent 0acea5f commit 1c64c1e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions examples/with-apollo/lib/apollo.js
Expand Up @@ -3,12 +3,12 @@ import App from 'next/app'
import { ApolloProvider } from '@apollo/react-hooks'
import createApolloClient from '../apolloClient'

// On the client we store the apollo client in the following variable
// this prevents the client from reinitializing between page transitions.
// On the client, we store the Apollo Client in the following variable.
// This prevents the client from reinitializing between page transitions.
let globalApolloClient = null

/**
* Installes the apollo client on NextPageContext
* Installs the Apollo Client on NextPageContext
* or NextAppContext. Useful if you want to use apolloClient
* inside getStaticProps, getStaticPaths or getServerProps
* @param {NextPageContext | NextAppContext} ctx
Expand All @@ -32,13 +32,13 @@ export const initOnContext = ctx => {
ctx.apolloClient ||
initApolloClient(ctx.apolloState || {}, inAppContext ? ctx.ctx : ctx)

// To avoid calling initApollo() twice in the server we send the Apollo Client as a prop
// to the component, 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
// the prop as `null` to the browser
// We send the Apollo Client as a prop to the component to avoid calling initApollo() twice in the server.
// 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
// the prop as `null` to the browser.
apolloClient.toJSON = () => null

// Add apolloClient to NextPageContext & NextAppContext
// Add apolloClient to NextPageContext & NextAppContext.
// This allows us to consume the apolloClient inside our
// custom `getInitialProps({ apolloClient })`.
ctx.apolloClient = apolloClient
Expand Down

0 comments on commit 1c64c1e

Please sign in to comment.