@apollo/client/utilities#concatPagination TypeScript Examples

The following examples show how to use @apollo/client/utilities#concatPagination. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: nextApollo.ts    From liferay-grow with MIT License 6 votes vote down vote up
function createApolloClient() {
  const Authorization = getToken();

  return new ApolloClient({
    cache: new InMemoryCache({
      typePolicies: {
        Query: {
          fields: {
            allPosts: concatPagination(),
          },
          keyFields: ['id'],
        },
      },
    }),
    link: new HttpLink({
      credentials: 'same-origin',
      headers: {
        Authorization,
      },
      uri: `${baseURL}/graphql`,
    }),
    ssrMode: typeof window === 'undefined',
  });
}
Example #2
Source File: apolloClient.ts    From next-page-tester with MIT License 6 votes vote down vote up
function createApolloClient() {
  return new ApolloClient({
    ssrMode: typeof window === 'undefined',
    link: new HttpLink({
      uri: 'https://nextjs-graphql-with-prisma-simple.vercel.app/api', // Server URL (must be absolute)
      credentials: 'same-origin', // Additional fetch() options like `credentials` or `headers`
      fetch,
    }),
    cache: new InMemoryCache({
      typePolicies: {
        Query: {
          fields: {
            allPosts: concatPagination(),
          },
        },
      },
    }),
  });
}
Example #3
Source File: cache.ts    From nextjs-hasura-fullstack with MIT License 6 votes vote down vote up
cache = new InMemoryCache({
  typePolicies: {
    Query: {
      fields: {
        feeds: concatPagination(),
        // boards: {
        //   merge(existing = [], incoming: any[]) {
        //     return [...existing, ...incoming]
        //   },
        // },
      },
    },
  },
})