import { ApolloClient, InMemoryCache, HttpLink } from '@apollo/client'; export const apolloClient = new ApolloClient({ ssrMode: typeof window === 'undefined', link: new HttpLink({ uri: process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT, credentials: 'include', }), cache: new InMemoryCache({ typePolicies: { Query: { fields: { products: { keyArgs: false, merge(existing = { edges: [] }, incoming) { return { ...incoming, edges: [...existing.edges, ...incoming.edges], }; }, }, }, }, }, }), });