<commit_before>import {
  ApolloClient,
  HttpLink,
  InMemoryCache,
  NormalizedCacheObject
} from "@apollo/client"

import fetch from "isomorphic-fetch"

let cachedClient: ApolloClient<NormalizedCacheObject>

const createApollo = () => new ApolloClient<NormalizedCacheObject>({
  ssrMode: process.browser === false,
  link: new HttpLink({
    uri: process.env.NEXT_PUBLIC_GRAPHQL,
    credentials: "same-origin",
    fetch
  }),
  cache: new InMemoryCache()
})

/**
 * Creates and returns a new ApolloClient instance
 */
function getApollo(initialState?: NormalizedCacheObject) {
  const client = cachedClient ?? createApollo()

  if (initialState) {
    const oldCache = client.extract()

    client.cache.restore({...oldCache, ...initialState})
  }

  // Always return a new client for SSR
  if (!process.browser) {
    return client
  }
<commit_msg>whisper: Small fix<commit_after>import {
  ApolloClient,
  HttpLink,
  InMemoryCache,
  NormalizedCacheObject
} from "@apollo/client"

import fetch from "isomorphic-fetch"

let cachedClient: ApolloClient<NormalizedCacheObject>

const createApollo = () => new ApolloClient<NormalizedCacheObject>({
  ssrMode: process.browser === false,
  link: new HttpLink({
    fetch,
    credentials: "same-origin",
    uri: process.env.NEXT_PUBLIC_GRAPHQL,
  }),
  cache: new InMemoryCache()
})

/**
 * Creates and returns a new ApolloClient instance
 */
function getApollo(initialState?: NormalizedCacheObject) {
  const client = cachedClient ?? createApollo()

  if (initialState) {
    const oldCache = client.extract()

    client.cache.restore({...oldCache, ...initialState})
  }

  // Always return a new client for SSR
  if (!process.browser) {
    return client
  }

{'fraction_non_alphanumeric': 0.11551925320886815, 'fraction_numerical': 0.0, 'mean_word_length': 4.15015015015015, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5512594', 'n_tokens_mistral': 549, 'n_tokens_neox': 518, 'n_words': 130}